none
.NET 4.0 Application Compatible with 2.0 and Above Assemblies RRS feed

  • Question

  • At my company, I have a variety of applications each on potentially one of three versions of Visual Studio (2005, 2008, 2010).  I provide a set of platforms that can be used in any application.  We also have various forms of each platform in that some are unmanaged, some are managed, and some are unmanaged with CLI interfaces for .NET programmers.  What we are trying to determine is if we can build a single platform version and have it compatible with 2005, 2008, and 2010 versions of unmanaged and managed components/framework.
    Software Engineer
    • Moved by Andrew.Wu Tuesday, August 23, 2011 3:21 AM (From:.NET Framework Setup)
    Saturday, August 20, 2011 6:38 PM

Answers

  • .NET2.0, 3.0 and 3.5 has same CLR (2.0) version, but .NET 4.0 use CLR 4.0, .NET team did a lot of work, but, it is not possible to make 100% compatibility between .NET 2.0 and .NET 4.0; If you try to upgrade to .NET 4.0, please do more tests to make sure your application can work on the newer runtime.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by MR MAB Tuesday, August 23, 2011 1:05 PM
    Tuesday, August 23, 2011 7:18 AM

All replies

  • Well, you can do that yes but you'll have to keep in mind that you won't be able to use any of the features offered by anything of .NET3.0 or above, if you want it to be compatible with 2.0. 
    0x2B |~ 0x2B Blog : www.it-ca.net/blogdylan
    • Proposed as answer by Andrew.Wu Monday, August 22, 2011 3:39 AM
    Saturday, August 20, 2011 9:50 PM
  • Yes, as Dylan has told you, all three Visual Studio versions you mention will target .NET Framework 2.0 (the ONLY common framework between them). So, if you are willing to limit yourself to 2.0, apps developed with VS 2005, VS 2008 and VS 2010 will all work on clients that have .NET Framework 2.0 installed.

    What will not work, however, is trying to work on a solution created in one Visual Studio version in a different VS version (without converting it). You can use the built in VS Upgrade Wizard to CONVERT a solution created in an older version of VS to work in a newer version of VS, but once converted, the solution will no longer open in an older VS version.

     

    • Proposed as answer by Andrew.Wu Monday, August 22, 2011 3:39 AM
    Sunday, August 21, 2011 7:27 PM
  • So if I create my common platform .NET components to be 2.0 .NET based and the application is built using 4.0 based .NET assemblies and framework, will things automatically work without having to rebuild the 2.0 components?
    Software Engineer
    Monday, August 22, 2011 1:32 PM
  • If your app is built targeting .NET Framework 4.0, it will NOT work on systems that have only .NET Framework 2.0.

    The only way you can get multiple solutions developed in VS 2005, 2008 and 2010 to all work in a common .NET Framework environment is to have all solutions target .NET Framework 2.0.

    Whether or not your 4.0 apps can reference a common component targeting .NET 2.0 should be resolved through testing (on machines with both .NET 2.0 and 4.0 installed). It *should* work, but as I'm sure you know, there are no universal truths in this business.

    Monday, August 22, 2011 1:45 PM
  • So just to be clear, if you deliver both the 2.0 and the 4.0 framework and the microsoft universe is perfect, it should work.  Right?
    Software Engineer
    Monday, August 22, 2011 2:06 PM
  • You're a software engineer, right?

    C'mon MR MAB, we both know that any answer I provide, without an analysis of the specifics of your common components and client apps, is just so much hot air :-)

    Yep, *should work*.

    I can say that I've seen **similar (I have no idea how similar)** apps targeting 4.0 referencing services targeting 2.0 work OK, but again, that's of very little value to you.

    Seriously, test a bit and if you run into issues, people here will try to help you as best we can.

     


    • Edited by pvdg42 Tuesday, August 23, 2011 3:43 AM
    Monday, August 22, 2011 4:33 PM
  • Yes, I understand.  What I was looking for was a pointer to a list of compatibility issues (if there are any).  I have to make a decison about whether to spend a fair amount of resources to upgrade platforms to VS 2010 and maintain two versions: VS2008 and VS2010 versions.  Or can I for a while just have the VS2008 version (no investment)?  I appreciate the simplicity of the answer, but the statement of "run into issues" implies that unknown issues may exist.  So my decision is to either upgrade with a known risk or stay as we are with unknown risk until we execute the project.  I'm trying to assess the unknown risk cost.
    Software Engineer
    Monday, August 22, 2011 4:50 PM
  • .NET2.0, 3.0 and 3.5 has same CLR (2.0) version, but .NET 4.0 use CLR 4.0, .NET team did a lot of work, but, it is not possible to make 100% compatibility between .NET 2.0 and .NET 4.0; If you try to upgrade to .NET 4.0, please do more tests to make sure your application can work on the newer runtime.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by MR MAB Tuesday, August 23, 2011 1:05 PM
    Tuesday, August 23, 2011 7:18 AM