调用assembly.getExportedTypes()时会抛出filenotfoundexception()
-
28-09-2019 - |
题
即使在安装应用程序之前已经安装了.NET 2.0 Framework运行时,我在剥落的XP SP3 X86虚拟机上运行.NET 2.0应用程序时会遇到此错误。
Exception Source: mscorlib Exception Type: System.IO.FileNotFoundException Exception Message: Could not load file or assembly 'WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Exception Target Site: GetExportedTypes ---- Stack Trace ---- System.Reflection.Assembly.GetExportedTypes() XSplit.Core.exe: N 00000 XSplit.Core.Capture.ChannelAddinManager.#Dm( As String) XSplit.Core.exe: N 00105 XSplit.Core.Capture.ChannelAddinManager.#Cm() XSplit.Core.exe: N 00265 XSplit.Core.Capture.ChannelAddinManager.Init(path As String, host As IAddinHost) XSplit.Core.exe: N 00104 XSplit.Core.frmLogin.InitializeAddinComponent() XSplit.Core.exe: N 00534 XSplit.Core.frmLogin..ctor(args As String[]) XSplit.Core.exe: N 01263
产生此错误的相关代码是
var assembly = Assembly.LoadFrom(dllFile); var assemblyTypes = assembly.GetExportedTypes();
即使在安装框架2.0 SP2之后,此错误仍会丢弃。
你们对为什么这样的线索有什么线索?
解决方案
WindowsBase组件直到.NET 3.0才能使用。如果您想在没有例外的情况下运行此代码,则需要在计算机上安装3.0,2.0不够好。检查加载项项目的构建设置,并确保其不引用任何WPF组件。
不隶属于 StackOverflow