Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downgrade an application from .net 4.0 to 3.5

Tags:

c#

.net

I have been developing an application in VS2010 and compiling it for the .NET 4.0 as the target framework. After integrating a library into my application, I get the following error message when I try to compile:

Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

The library works fine under .NET 3.5, but when I change my target framework to .NET 3.5, I get the following error for all my .resx files:

Error 1 Object reference not set to an instance of an object.

I tried ctrl-h Version=4.0.0.0 to Version=3.5.0.0 but that doesn't seem to work. Is there anything I can do other that create a new application?

like image 604
Serge Avatar asked Jul 05 '10 19:07

Serge


3 Answers

Open your .resx file with the XML editor instead of the resources editor, and search for System.Windows.Forms, Version=4.0.0.0. There should be 2 instances of this string. Replace 4.0.0.0 with 2.0.0.0 and save the file. Your resources should work correctly now.

Note that you can also go back to .NET 4 and try to add the following to your App.config to allow older assemblies to run on the new runtime:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>
like image 149
Julien Lebosquain Avatar answered Oct 23 '22 14:10

Julien Lebosquain


You should be able to make this work by configuration settings in app.Config.

Just add the useLegacyV2RuntimeActivationPolicy="true" flag to your appConfig in the startup section. This causes the .NET 4 runtime to handle older mixed-mode assemblies.

like image 5
Reed Copsey Avatar answered Oct 23 '22 14:10

Reed Copsey


Open Properties of project. Then select the Resources. Delete all resource images and insert them again. now compile it. Your project is working now.. :)

like image 2
Ravish Avatar answered Oct 23 '22 14:10

Ravish