Assembly asm = null;
asm = Assembly.LoadFile(asmName); //这里执行成功,不抛出Exception,返回值也正常try
{
Type[] types = asm.GetTypes(); //这里抛出[System.Reflection.ReflectionTypeLoadException]{"Could not load file or assembly 'A, Version=6.0.18.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"A, Version=6.0.18.0, Culture=neutral, PublicKeyToken=null"}System.Exception {System.IO.FileNotFoundException}
}
catch (System.SystemException e)
{}
请问这是什么错误啊,如果我直接Load(A),那也是成功的。我刚刚接触.NET 编程,请大家能不能解释的细些,另外我也找了很多的资料,但是都没有明确的答案。
asm = Assembly.LoadFile(asmName); //这里执行成功,不抛出Exception,返回值也正常try
{
Type[] types = asm.GetTypes(); //这里抛出[System.Reflection.ReflectionTypeLoadException]{"Could not load file or assembly 'A, Version=6.0.18.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"A, Version=6.0.18.0, Culture=neutral, PublicKeyToken=null"}System.Exception {System.IO.FileNotFoundException}
}
catch (System.SystemException e)
{}
请问这是什么错误啊,如果我直接Load(A),那也是成功的。我刚刚接触.NET 编程,请大家能不能解释的细些,另外我也找了很多的资料,但是都没有明确的答案。
文件没找到,路径有误
1: 与asmName同目录
2: project的Debug目录下
1: 与asmName同目录
2: project的Debug目录下
A.dll是楼主自己写的DLL文件吗?
如果是,注意一下编译时的路径,最好放在与引用它的同一文件夹中编译
以前这问题我也有过