简体   繁体   中英

Downgrade an application from .net 4.0 to 3.5

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?

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>

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM