如何解决加载程序集时出现 FileNotFoundException
当我尝试访问已加载程序集的 ExportedTypes 时,我收到 FileNotFoundException。
基本上,我有一个包含两个项目的解决方案:Proj1 和 Proj2。 Proj1 有来自 Proj2 的引用,我正在尝试通过它们的路径加载 Proj1 的 DLL。 这是我尝试过的代码:
Dim sLoad As System.Reflection.Assembly
Try
sLoad = System.Reflection.Assembly.LoadFrom(PathDLL)
Dim ob = sLoad.ExportedTypes
Catch ex As System.IO.FileNotFoundException
Dim msh = ex.Message
End Try
我已经检查了 AppDomain.CurrentDomain.GetAssemblies() 并且已经组装到我的 Proj2,所以我不明白为什么它不起作用。 也已经尝试过 LoadFile。
这是我的错误信息:
Could not load file or assembly 'Proj2,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
这是我的融合日志:
=== Pre-bind state information ===
LOG: DisplayName = Proj2,PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/jsantos/Source/Workspaces/UP/UP/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\jsantos\Source\Workspaces\UP\UP\bin\Debug\UP.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private,custom,partial,or location-based assembly bind).
LOG: The same bind was seen before,and was failed with hr = 0x80070002.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。