I have no longer any references to this assembly anywhere that I can find. Any ideas on why I would be getting this error. The project builds fine, however when I run in debug or release mode I get the runtime exception. I am running visual studio 2013.
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.
I found that there was still a MyAssembly.dll file in the bin folder for my project. Deleted the file and now it runs.
User contributions licensed under CC BY-SA 3.0