Error
发现xxx.dll在另一程序中用Assembly.LoadFile("xxx.dll")加载过。如果不关闭这个程序,在vs下编译就会有问题。究其原因是loadfile后没有释放,导致vs覆盖文件失败。
解决方案:
1.用AppDomain新建一个应用程序域。具体的百度下就可以。个人感觉比较麻烦。
2.绕过此方法。代码如下:
using System.Reflection;
using System.IO;
MemoryStream memStream;
using(FileStream stream = new FileStream(@"C:\MyAssembly.dll", FileMode.Open))
{
}
Assembly asm = Assembly.Load(memStream.ToArray());
MessageBox.Show(asm.FullName);