views:

50

answers:

2

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?

+2  A: 

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

Aaron
I have both .net 2 and .net 4 frameworks installed on my machine. But I get the error "Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
Rajah
@Rajah looked up Microsoft.Practices.EnterpriseLibrary.Data and it said it is for 2.0 and 3.0 but 3.0 is needed for specific things...do you also have 3 on there?
Aaron
It looked like VS 2010, automatically updated the dll ref to V5 (which is also installed on my machine). Once I removed it and readded v3.0 of EntLib, it began working without a problem.
Rajah
A: 

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.

Aphex