Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
I have developed a class library in .net framework 4.0 in which i am referring System.Net.Http namespace. Now i have to refer this dll into my existing application(running v3.5) and done it. While executing the application shows the following error

"This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Please comment.
Posted

1 solution

You cannot use a later version of .net assemblies with an older version (i.e. v4 in a v3.5 application) this is because of the possible use of newer runtime features which don't exist in the older runtime.

You can however do the opposite (i.e. use a v2 dll in a v2+ application).

If you are not using newer features then compile your DLL to v3.5 and use that.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 21-May-14 11:13am    
This is not a comment, but an answer which I recommend to accept formally. "Is built by runtime" simply means that each .NET Framework version comes with the compiler and everything else (MSBuild, libraries used by the compiler); all compiled with this .NET version. It's quite obvious why you cannot access newer libraries installed with newer .NET version. If it was possible, it was a real disaster.
—SA
Sergey Alexandrovich Kryukov 21-May-14 11:13am    
Please see my comment above. My 5.
—SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900