Assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

I recently received this error message :



Could not load file or assembly 'Proj.domain' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

My platform:

ASP.Net Framework 4.0

My issues:

When I check the bottom of the Error screen, I could see the Version Information is set as 2.0 and my application is built in .Net version 4.0. I have checked the application properties and it was set to 4.0. This error was occurring only after I deployed it to the server. The application was working perfect in my local machine.

Solution:


 The solution depends upon which platform you are using and where you are facing issue.

I solved it by changing the ASP.NET framework tab settings to 4.0 in IIS of the server where I deploying the application.

The first thing you should check is the properties of your application by right clicking on the solution and select the 'Application' option. Check for the framwork and change it to appropriate.

If you are having  a .NET 4.0 dll project that is being called by a .NET 2.0 project, then you should either have to upgrade the .NET 2 project to .NET 4, or downgrade the .NET 4 project to .NET 3.5 (or earlier).

Since only one version of the run-time can be loaded into a process,the options are:
  • Upgrade the .Net 2.0 project
  • Wrap the .Net 2.0 project (if the source is not yours)
  • Downgrade the .Net 4.0 project
  • Load the .Net 4.0 project into it's own process
  •  


1 comment: