locked
Different Version of DLL for .NET framework RRS feed

  • Question

  • Hi All,

    Currently I have installed 2 frameworks i.e Framework 4.0 and Framework 4.5.2

     I have code (dll) which is built in Framework 4.5.2 and I want to use it in Framework 4.0.

    Does VS support this operatability meaning supporting higher version in Smaller version (I know we can support small version in higher version) ?

    Thanks.

    Wednesday, March 18, 2015 1:18 PM

Answers

  • Hi,

    An assembly compiled against .NET 4.0 can run on .NET 4.5.x (backward compatibility).

    The opposite (forward compatibility) is not true, because a .NET Framework is a Common Language Runtime (CLR) + .NET Libraries, and therefore the CLR can be different and the .NET 4.0 may not have libraries provided by .NET 4.5.x.

    See:

    Version Compatibility in the .NET Framework
    https://msdn.microsoft.com/en-us/library/ff602939(v=vs.110).aspx


    * My new blog about VSX: http://www.visualstudioextensibility.com * Twitter: https://twitter.com/VSExtensibility * MZ-Tools productivity extension for Visual Studio: http://www.mztools.com.

    • Proposed as answer by Caillen Thursday, March 19, 2015 6:29 AM
    • Marked as answer by Caillen Thursday, March 26, 2015 9:06 AM
    Wednesday, March 18, 2015 9:25 PM

All replies

  • As long as you just code to the 4.0 framework, it should run just fine on machines with updated versions. Note, you should change the framework target in your project settings, to ensure you don't pick up anything specific to the newer updates.

    Sincerely,


    Ed Dore

    Wednesday, March 18, 2015 9:21 PM
  • Hi,

    An assembly compiled against .NET 4.0 can run on .NET 4.5.x (backward compatibility).

    The opposite (forward compatibility) is not true, because a .NET Framework is a Common Language Runtime (CLR) + .NET Libraries, and therefore the CLR can be different and the .NET 4.0 may not have libraries provided by .NET 4.5.x.

    See:

    Version Compatibility in the .NET Framework
    https://msdn.microsoft.com/en-us/library/ff602939(v=vs.110).aspx


    * My new blog about VSX: http://www.visualstudioextensibility.com * Twitter: https://twitter.com/VSExtensibility * MZ-Tools productivity extension for Visual Studio: http://www.mztools.com.

    • Proposed as answer by Caillen Thursday, March 19, 2015 6:29 AM
    • Marked as answer by Caillen Thursday, March 26, 2015 9:06 AM
    Wednesday, March 18, 2015 9:25 PM