Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading a .Net 2.0 project to .Net 4.0

I have a .Net 2.0 project that depends on many 3rd party .Net dlls (all of which obviously target .Net 2.0).

If I were to migrate my project to VS2010 and target the .Net 4.0 framework, will my app still build? Or will it complain about the .Net 2.0 dll references and I will have to find .Net 4.0 versions of these 3rd party dlls?

like image 463
Raj Rao Avatar asked Oct 12 '10 17:10

Raj Rao


2 Answers

Yes it will work. Make sure that you have both the .NET 2 and 4 FW installed on the machines executing the application.

like image 127
Aaron McIver Avatar answered Oct 12 '22 23:10

Aaron McIver


If you need to use older assemblies with 4.0 (Mixed-Mode) you may need to add the following to <yourappname>.config:

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

I had to do this when I attempted to load some old 1.1 assemblies into my Ironpython program (.NET 4.0) and got the following error:

"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."

Adding those three lines to my ipyw.exe.config file let me run those assemblies in mixed mode.

like image 35
Aphex Avatar answered Oct 12 '22 22:10

Aphex