解决 Assembly.LoadFile 文件被锁定的 问题
2012-10-16 16:30
176 查看
使用 Assembly.LoadFile 加载程序集后 ,被加载的文件就会被锁定,之后就不能对其执行转移、删除等操作
为了解决次问题,我们可以先读取成字节流,然后转换成Assembly。代码如下:
public static Assembly LoadAssemblyFromFile(string fileFullName)
{
byte[] b = File.ReadAllBytes(fileFullName); Assembly asm = Assembly.Load(b);
return asm;
}
原文地址:/article/5883672.html
作者 : 徐明祥
出处:http://www.cnblogs.com/xumingxiang
版权:本文版权归作者和博客园共有
转载:欢迎转载,为了保存作者的创作热情,请按要求【转载】,谢谢
要求:未经作者同意,必须保留此段声明;必须在文章中给出原文连接;否则必究法律责任
为了解决次问题,我们可以先读取成字节流,然后转换成Assembly。代码如下:
public static Assembly LoadAssemblyFromFile(string fileFullName)
{
byte[] b = File.ReadAllBytes(fileFullName); Assembly asm = Assembly.Load(b);
return asm;
}
原文地址:/article/5883672.html
作者 : 徐明祥
出处:http://www.cnblogs.com/xumingxiang
版权:本文版权归作者和博客园共有
转载:欢迎转载,为了保存作者的创作热情,请按要求【转载】,谢谢
要求:未经作者同意,必须保留此段声明;必须在文章中给出原文连接;否则必究法律责任
相关文章推荐
- 解决Assembly.LoadFile文件被锁定的问题
- 记录一个问题 lua_tinker中load_file 的lua文件包含require报错解决办法
- C#.Net中解决PictureBox控件用FormFile方法后文件被锁定的问题
- 解决Could not load file or assembly CefSharp.Core.dll的问题
- Asp.Net 关于Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies.问题的解决方法。
- “Could not load file or assembly 。。。试图加载格式不正确的程序”的问题解决
- 解决 File GDB 文件锁定的问题
- “Could not load file or assembly'OracleDAL' or one of its dependencies. 系统找不到指定文件”解决方法
- VS2015解决问题 Could not load file or assembly 'Microsoft.VisualStudio.ConnectedServices, Version=2.0.0.
- 解决Could not load file or assembly CefSharp.Core.dll的问题
- Could not load file or assembly 'vjscor, Version=2.0.0.0, Culture=neutral, 问题解决方法
- system.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727'...问题解决方案
- PHP文件写入函数file_put_contents并发追加写入丢失内容问题解决方法
- Linux解决问题篇——ftp上传文件(使用put)时,permission denied,下载文件(使用get)时,failed to open file
- 解决rails4.0中send_file文件下载两次的问题
- 添加文件【COCOS2DX-LUA 脚本开发之十三】解决lua项目编译Android出现get data from file failed、Cocos2dxActivity cannot be 路径等问题
- input type="file" 选取文件路径时出现fakepath问题IE浏览器解决办法
- 2、fatal error: malformed or corrupted AST file: 'Unable to load module Darwin.pcm 问题解决
- Linux执行.sh文件,提示No such file or directory的问题的解决方法
- fatal error: malformed or corrupted AST file: 'Unable to load module Darwin.pcm 问题解决