Raj Rao
Raj Rao

Reputation: 9138

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?

Upvotes: 5

Views: 3994

Answers (2)

Aphex
Aphex

Reputation: 7490

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.

Upvotes: 2

Aaron McIver
Aaron McIver

Reputation: 24713

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

Upvotes: 3

Related Questions