32

I am converting the .vcproj from VS2005 to VS2010 but after converting it is giving the below mentioned error.

Additional information: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.Additional information: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

and then i have added the app.config file in my project and added the below mentioned information in my file but it is still giving the same error.

can any one help me in resolving the above mentioned problem.

Bobby
  • 11,419
  • 5
  • 44
  • 69
kapil
  • 321
  • 1
  • 3
  • 3
  • 2
    See http://stackoverflow.com/questions/2455654/what-additional-configuration-is-necessary-to-reference-a-net-2-0-mixed-mode-a – Pavel Chuchuva May 17 '11 at 01:46

4 Answers4

70

Add this to your web/app config:

<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0"/>
</startup>

Also see here

Community
  • 1
  • 1
Matt B
  • 8,315
  • 2
  • 44
  • 65
  • 1
    I have added this to my config file but still the same problem is coming. I have added this information in app.config file. same error. – kapil Aug 16 '10 at 07:25
  • my this project uses the dll which has been generated from the 2.0 version and the project which i am trying to convert from VS2005 to VS2010 is using this dll and that one is using the ver 4.0 .net framework. – kapil Aug 16 '10 at 07:54
  • any help on the above mentioned issue. – kapil Aug 16 '10 at 08:46
  • we have multiple codes written in C# and C++ which use the dll which was generated in 2.0 .net fram work but the code which use this dll was written in visula studio 2005 and when we try to use the visual studio 2010 for the C++ and C# code then automatic conversion starts and visual studio add the app.config file in the converted project automatically and in that app.config i have added the startup useLegacyV2RuntimeActivationPolicy="true"> section and after that code starts working fine. – kapil Aug 16 '10 at 09:43
  • but when i try to perform the same thing with the C++ code then that project gets converted from VS2005 to VS2010 but it does not add the app.config file in that and i need to explicitly add the app.config file in that and added the same section in the app.config but it does not work with the C++ code and gives the same error of mixed assembly. – kapil Aug 16 '10 at 09:43
  • 1
    Thanks nukefusion, Its worked for me. – Sensa Apr 30 '12 at 19:23
10

I added the following:

<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0"/>
  <requiredRuntime version="v4.0.20506"/>
</startup>

to my app.config for a VS2008 Express Edition to VS2010 Express Edition imported project. Worked fine for me.

Rich Elswick
  • 561
  • 5
  • 20
1

Open each project's properties - and set version to either 2.0/3.0/3.5 or 4.0

abatishchev
  • 98,240
  • 88
  • 296
  • 433
  • I have setted the above thing in Project properties-> Configuration Properties->Linker->General and copied the value 2.0/3.0/3.5 or 4.0 but still same error. – kapil Aug 16 '10 at 07:33
  • @kapil: Does all projects has the same version group? i.e. either all are 2.0/3.5 or all are 4.0 ? – abatishchev Aug 16 '10 at 07:43
  • my this project uses the dll which has been generated from the 2.0 version and the project which i am trying to convert from VS2005 to VS2010 is using this dll and that one is using the ver 4.0. – kapil Aug 16 '10 at 07:52
  • any help on the above mentioned issue. – kapil Aug 16 '10 at 08:47
0

Try to use another config file (not the one from your project) and RESTART Visual Studio:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.x86.exe.config (32-bit)

or

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.exe.config (64-bit)