2014年6月27日 星期五

Dot NET Framework各版本間的相容性

很多人都不了解到底.NET Framework各版本間的相容性為何,其實 .NET Framework versions 2.0, 3.0, and 3.5 使用相同版本的CLR (CLR 2.0)。當安裝 .NET Framework3.5時, 將自動得到 2.0 and 3.0 layers,所以使用 2.0, 3.0 and 3.5 build的應用程式可以執行在已經安裝.NET Framework3.5的機器上。這就是所謂的backward compatibility ,使用較早版本開發的應用程式可以在已經安裝後面版本的 .NET Framework的機器上執行。
而.NET Framework 4, 4.5, 和後面的版本是使用 CLR 4,但是沒有  CLR 3。
.net framework 3.5 already including 2.0 support,所以不需要再安裝.Net Framework 2.0。




參考資料:
Targeting and running apps for older versions

The .NET Framework versions 2.0, 3.0, and 3.5 are built with the same version of the CLR (CLR 2.0). These versions represent successive layers of a single installation. Each version is built incrementally on top of the earlier versions. It is not possible to run versions 2.0, 3.0, and 3.5 side by side on a computer. When you install version 3.5, you get the 2.0 and 3.0 layers automatically, and apps that were built for versions 2.0, 3.0, and 3.5 can all run on version 3.5. However, the .NET Framework 4 ends this layering approach, so apps built for 2.0. 3.0, or 3.5 will not work on version 4 or later. Starting with the .NET Framework 4, you can use in-process side-by-side hosting to run multiple versions of the CLR in a single process. For more information, see Assemblies and Side-by-Side Execution.
In addition, if your app targets version 2.0, 3.0, or 3.5, your users may be required to enable the .NET Framework 3.5 on a Windows 8 or Windows 8.1 computer before they can run your app.


Version Compatibility


The degree of .NET Framework support for backward and forward compatibility is version-specific. The .NET Framework supports both backward and forward compatibility for applications created using version 1.1 only. It does not support forward compatibility in applications created using version 2.0. In the context of the .NET Framework, backward compatibility means that an application created using an early version of the .NET Framework will run on a later version. Conversely, forward compatibility means that an application created using a later version of the .NET Framework will run on an earlier version.

The .NET Framework provides a high degree of support for backward compatibility. For example, most applications created using version 1.0 will run on version 1.1 and applications using version 1.1 will run on version 2.0. The .NET Framework also supports forward compatibility for version 1.1 only. However, for forward compatibility you might need to modify an application so that the application runs as expected. Applications created with version 2.0 will not run on earlier versions of the .NET Framework. For both backward and forward compatibility, a change to the .NET Framework that helps improve security, correctness, or functionality might also raise compatibility issues.


.NET Framework Versions and Dependencies

Each new version of the .NET Framework retains features from the previous versions and adds new features. The CLR is identified by its own version number. The .NET Framework version number is incremented at each release, although the CLR version is not always incremented. For example, the .NET Framework 4, 4.5, and later releases include CLR 4, but the .NET Framework 2.0, 3.0, and 3.5 include CLR 2.0. (There was no version 3 of the CLR.)


 .NET Framework 4.5的應用程式相容性請參考以下資訊:

Application Compatibility in the .NET Framework 4.5

The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance.
The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio, or you can specify the supported runtime with the <supportedRuntime> Element in an application configuration file.

Application Compatibility in the .NET Framework 4.5

Application Compatibility in the .NET Framework 4.5.1

Application Compatibility in the .NET Framework 4.5.2

In the table, the versions marked with * must be enabled in Control Panel (for Windows) or enabled through the Server Manager (for Windows Server).
.NET Framework version
CLR version
Features
Included in Visual Studio version
Included in
+ Can be installed on
Windows
Included in
+ Can be installed on
Windows Server
To determine installed .NET version
4.5.2
4
·    New APIs for transactional systems and ASP.NET
·    System DPI resizing in Windows Forms controls
·    Profiling improvements
·    ETW and stress logging improvements
·    More...
-
+ 8.1
+ 8
+ 7
+ Vista
+ 2012 R2
+ 2012
+ 2008 R2 SP1
+ 2008 SP2
Use Release DWORD: 379893
(see instructions)
4.5.1
4
·    Support for Windows Phone Store apps
·    .NET Native
·    Automatic binding redirection
·    Performance and debugging improvements
·    More...
2013
8.1
+ 8
+ 7
+ Vista
2012 R2
+ 2012
+ 2008 R2 SP1
+ 2008 SP2
Use Release DWORD:
·    378675 (Windows 8.1)
·    378758 (all other)
(see instructions)
4.5
4
·    Support for Windows Store apps
·    WPF, WCF, WF, ASP.NET updates
·    More...
2012
8
+ 7
+ Vista
2012
+ 2008 R2 SP1
+ 2008 SP2
Use Release DWORD: 378389
(see instructions)
4
4
·    Expanded base class libraries
·    Cross-platform development with Portable Class Library
·    MEF, DLR, code contracts
·    More...
2010
+ 7
+ Vista
+ 2008 R2 SP1
+ 2008 SP2
+ 2003
3.5
2.0
·    AJAX-enabled websites
·    LINQ
·    Dynamic data
·    More...
2008
7
8.1*
8*
+ Vista
2008 R2 SP1*
+ 2012 R2
+ 2012
+ 2008 SP2
+ 2003
3.0
2.0
·    WPF, WCF, WF, CardSpace
-
Vista
2008 R2 SP1*
2008 SP2*
+ 2003
2.0
2.0
·    Generics
·    ASP.NET additions
·    More...
2005
-
2008 R2 SP1
2008 SP2
2003
1.1
1.1
·    ASP.NET and ADO.NET updates
·    Side-by-side execution
·    More...
2003
-
2003
1.0
1.0
First version of the .NET Framework.
Visual Studio .NET
-
-
In general, you should not uninstall any versions of the .NET Framework that are installed on your computer, because an application you use may depend on a specific version and may break if that version is removed. You can load multiple versions of the .NET Framework on a single computer at the same time. This means that you can install the .NET Framework without having uninstall previous versions.


沒有留言:

張貼留言