'Could not load file or assembly ':This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded
I Hvea 3 projects in my solution: BL, DL and the UI. All three projectshave a target framework of >NET 4; I have double-checked this by looking at the property page for each project. I am receiving the following error message when I try run the website at the hosting environment but not when I run it locally.
Could not load file or assembly 'BL' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Thanks in advance!
Solution 1:[1]
-Go to IIS. -Default WebSite-> Your application Directory->Advance Settings->Application Pool-> Set your Version (Ex. ASP.NET v4.0) -Refresh your Application Directory and Browse it. It's done.
Solution 2:[2]
I received the same error when I tried to upgrade my application from .NET 3.5 to .NET 4.5. When I reverted the changes (something when wrong, I'll figure it out later) I received the error:
Could not load file or assembly 'XmlSerializers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
This dll was in my project's bin folder. When I deleted it the application ran as normal.
Solution 3:[3]
You might also have to run ASP.NET IIS Registration tool (Aspnet_regiis.exe) - more details here
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i
Solution 4:[4]
Check this line in app.config file to see if the .NET Framework version is correct, if not change it to the version which is set in application properties.
Solution 5:[5]
I found same error while running on v2.0 and when change version to v4.0 it's work successfully
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user2721039 |
| Solution 2 | jade290 |
| Solution 3 | Henrique Zacchi |
| Solution 4 | Rahul Sutar |
| Solution 5 | Hassan Elshazly Eida |
