使用 Assembly.LoadFile 加载程序集后 ,被加载的文件就会被锁定,之后就不能对其执行转移、删除等操作
    为了解决次问题,我们可以先读取成字节流,然后转换成Assembly。代码如下:
   public static Assembly LoadAssemblyFromFile(string fileFullName)
        {
            byte[] b = File.ReadAllBytes(fileFullName);
            Assembly asm = Assembly.Load(b);
            return asm;

        }

 
原文地址:http://www.cnblogs.com/xumingxiang/archive/2012/10/16/2726269.html

 

作者 : 徐明祥
出处:http://www.cnblogs.com/xumingxiang 
版权:本文版权归作者和博客园共有
转载:欢迎转载,为了保存作者的创作热情,请按要求【转载】,谢谢
要求:未经作者同意,必须保留此段声明;必须在文章中给出原文连接;否则必究法律责任 

相关文章:

  • 2022-02-19
  • 2021-08-27
  • 2021-12-24
  • 2021-10-13
  • 2021-11-02
  • 2022-01-15
  • 2022-12-23
猜你喜欢
  • 2021-09-09
  • 2022-12-23
  • 2021-07-12
  • 2021-10-29
  • 2021-10-24
  • 2021-09-19
  • 2021-08-22
相关资源
相似解决方案