Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 15-Feb-11 4:07am
jashimu651
Comments
Nishant Sivakumar at 15-Feb-11 10:21am
   
Updated my answer.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v4
Comments
Sandeep Mewara at 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.
SAKryukov at 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
Nishant Sivakumar at 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 at 16-Feb-11 11:18am
   
Nishant, I still have the problem. I could not solved it. I don't what else I should try.
Nishant Sivakumar at 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.
jashimu at 16-Feb-11 11:44am
   
I am using sqlite as database. Do you think sqlite dll does not work on 4.0. I don't see anything else I am doing wrong.
Nishant Sivakumar at 16-Feb-11 11:45am
   
I believe sqllite is purely native, so I don't think it's a factor.
Espen Harlinn at 16-Feb-11 15:24pm
   
sqlite can be compiled as a managed assembly :) I think OP should take a look at http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki for managed only version : http://sqlite.phxsoftware.com/
Nishant Sivakumar at 16-Feb-11 15:29pm
   
Ah okay, so it's possible that the version he's using is compiled for .NET 2.0. That might be it, Espen.

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,518
1 Tadit Dash 350
2 Manas Bhardwaj 319
3 OriginalGriff 243
4 Sergey Alexandrovich Kryukov 240
0 Sergey Alexandrovich Kryukov 9,530
1 OriginalGriff 5,716
2 Peter Leow 4,320
3 Maciej Los 3,540
4 Abhinav S 3,373


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 15 Feb 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid