Click here to Skip to main content
11,635,053 members (73,753 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi,

I've upgraded a class library project in my solution to .NET Framework 4.0. But after the upgrade I figured out the server i'm using doesn't support .NET Framework 4.0.

So I had to downgrade again to v3.5. But after doing this, I cannot run my application anymore. When I run it, it compiles correctly, starts up the browser and then I get this error:

 
Could not load file or assembly 'Xxxxx_DLL' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 
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 'Xxxxx_DLL' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
 

The webapplication using the assambly is set to .NET Framework 3.5 and the assambly itself is also set to .NET Framework 3.5. So this error should not be possible.

Do you guys have any suggestions?
Posted 15-Feb-13 0:41am
Edited 15-Feb-13 0:42am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The problem is likely to be in one or more of the assemblies you are referencing as part of your application.

Go into your project in VS, open up the "References" branch, and make a note of all the references you are using. You can then highlight each one in turn and look at the "Runtime Version" property in the Properties pane. At least one will be greater than the 3.5 your app is expecting.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Turns out the updated DLL (v4) was still in the Bin directory under a different name. Forgot I renamed the projectname.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,419
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205


Advertise | Privacy | Mobile
Web02 | 2.8.150728.1 | Last Updated 15 Oct 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100