2014-10-17 29 views
0

我無法找到任何可以引用的程序集。任何想法,爲什麼我會得到這個錯誤。該項目建立良好,但是當我在調試或發佈模式下運行,我得到運行時異常。我正在運行visual studio 2013.從我的解決方案中刪除的DLL出現「無法加載文件或程序集」錯誤

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.BadImageFormatException: Could not load file or assembly 'MyAssembly' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MyAssembly' could not be loaded. 


=== Pre-bind state information === 
LOG: User = User 
LOG: DisplayName = MyAssembly 
(Partial) 
LOG: Appbase = file:///C:/Path/To/Project/ 
LOG: Initial PrivatePath = C:\Path\To\project\bin 
Calling assembly : (Unknown). 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Path\To\Project\web.config 
LOG: Using host configuration file: C:\Users\User\IISExpress\config\aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config. 
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 
LOG: Attempting download of new URL file:///C:/Users/User/AppData/Local/Temp/Temporary ASP.NET Files/platform/9a483fd2/913db7f0/MyAssembly.DLL. 
LOG: Attempting download of new URL file:///C:/Users/User/AppData/Local/Temp/Temporary ASP.NET Files/platform/9a483fd2/913db7f0/MyAssembly/MyAssembly.DLL. 
LOG: Attempting download of new URL file:///C:/Path/To/Project/bin/MyAssembly.DLL. 
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated. 
+0

是否在您的web.config或IIS Express配置中提及? – DavidG 2014-10-17 23:28:35

+0

GAC中的任何舊東西可能仍然依賴於程序集? – Ian 2014-10-17 23:28:55

+0

我在GAC或IIS Express配置中找不到任何東西 – flerngobot 2014-10-17 23:37:01

回答

1

我發現在我的項目的bin文件夾中仍然存在MyAssembly.dll文件。刪除該文件,現在運行。

+1

只是爲了進一步擴展爲什麼發生這種情況,如果您刪除對DLL的引用但未首先清理項目,那麼當您再次運行清理時,它只會刪除/刷新項目中引用的DLL。 – 2014-10-18 01:21:20

相關問題