2010-10-08 49 views
1

在精簡XP SP3 x86虛擬機上運行.net 2.0應用程序時出現此錯誤,即使.net 2.0框架運行時已在安裝之前安裝應用程序。在調用Assembly.GetExportedTypes()時引發FileNotFoundException()

 
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後,這個錯誤仍然拋出。

你們有什麼線索,爲什麼這是?

回答

2

WindowsBase程序集在.NET 3.0之前不可用。如果你想在沒有異常的情況下運行這個代碼,那麼你需要在機器上安裝3.0,2.0不夠好。檢查加載項目的構建設置並確保它不引用任何WPF程序集。

+0

構建目標是.net 2.0,並且沒有引用的程序集都是WPF,所以我們對爲什麼會引發此錯誤感到困惑。 – sjlewis 2010-10-12 06:53:49

相關問題