Click here to Skip to main content
15,897,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I am having some problems. I have a windows application is written in vs 2005 then I converted into VS2010. I can't run the application because of assembly problem. when I run it says,"Mixed mode assembly is built against version'v2.0.50727' of hte runtime and cannot be loaded in teh 4.0 runtime without additional configuration information."

I googled it found some clue but did not help. I don't even have idea what to do.
thanks all.
Posted
Updated 5-Dec-18 22:45pm
Comments
Nish Nishant 15-Feb-11 10:21am    
Updated my answer.

It seems that your C# project references a C++/CLI project that has not yet been updated to .NET 4.0.

[Edit]
~~~~~~~

Open your C++/CLI project in VS 2010 and build it again. And then make sure your C# project is referencing the new DLL and not the old one.

[Edit 2]
~~~~~~~~~

This is in response to SA's comment:

You can only add a reference to the same runtime version. .NET 2.0, 3.0 and 3.5 are all under the 2.0 runtime, so they can be used with each other. .NET 4.0 uses an entirely new 4.0 runtime and so you cannot mix references with older versions.
 
Share this answer
 
v4
Comments
Sandeep Mewara 15-Feb-11 10:13am    
Comment from OP:
Nishant, thanks for your quick reply. You are right. what should I do. My solution has two project one is in C# another is in C++/CLI.

thanks again.
Sergey Alexandrovich Kryukov 15-Feb-11 15:30pm    
Nishant, this is weird. Normally, you can reference an assembly compiled for lower version of .NET. Maybe, this is a peculiarity of mixed-mode only, what do you think?
--SA
Nish Nishant 15-Feb-11 15:35pm    
You can only add a reference to the same runtime version. .NET 2.0, 3.0 and 3.5 are all under the 2.0 runtime, so they can be used with each other. .NET 4.0 uses an entirely new 4.0 runtime and so you cannot mix references with older versions.
jashimu 16-Feb-11 11:18am    
Nishant, I still have the problem. I could not solved it. I don't what else I should try.
Nish Nishant 16-Feb-11 11:39am    
If you are sure you rebuild the C++/CLI DLL as .NET 4.0, then if you still get the same error you can be reasonably sure you are somehow using the old DLL.

Try copying the C# and C++/CLI DLL to a fresh machine to see if you get the error.
The exception clearly identifies some .NET 2.0.50727 component was included in .NET 4.0. In App.config file use this:

<startup useLegacyV2RuntimeActivationPolicy="true" /> 
 
Share this answer
 

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