5

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
  • Aaron's answer seems to be correct.
    – Raj Rao
    Oct 12, 2010 at 19:10
  • After some testing, here is what I found out: ASP.Net and CmdLine app both worked after retargetting to .Net 4.0. No changes had to be made to the config file. In addition 3rd party dlls (built with .Net 2.0) that I was using to generate PDF files were also working just like they used to under .net 3.5. Will update if I find any gotchas
    – Raj Rao
    Oct 12, 2010 at 19:11

2 Answers 2

3

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

3
  • 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)"
    – Raj Rao
    Oct 12, 2010 at 18:24
  • @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? Oct 12, 2010 at 18:51
  • 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.
    – Raj Rao
    Oct 12, 2010 at 19:08
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.