移至 .NET 框架 4.8、4.7、4.6 和 4.5Migrate to .NET Framework 4.8, 4.7, 4.6, and 4.5

如果使用早期版本的 .NET Framework 創建應用,通常可以將其升級到 .NET Framework 4.5 及其點版本(4.5.1 和 4.5.2)、.NET Framework 4.6 及其點版本(4.6.1 和 4.6.2)、.NET Framework 4.7 及其點版本(4.7.1 和 4.7.2)或 .NET Framework 4.8。If you created your app using an earlier version of .NET Framework, you can generally upgrade it to .NET Framework 4.5 and its point releases (4.5.1 and 4.5.2), .NET Framework 4.6 and its point releases (4.6.1 and 4.6.2), .NET Framework 4.7 and its point releases (4.7.1 and 4.7.2), or .NET Framework 4.8 easily. 在 Visual Studio 中,開啟您的專案。Open your project in Visual Studio. 如果您的專案是使用舊版 Visual Studio 所建立,則會自動開啟 [專案相容性]**** 對話方塊。If your project was created in an earlier version of Visual Studio, the Project Compatibility dialog box automatically opens. 如需升級 Visual Studio 專案的詳細資訊,請參閱移植、移轉及升級 Visual Studio 專案Visual Studio 2019 平台目標及相容性For more information about upgrading a project in Visual Studio, see Port, Migrate, and Upgrade Visual Studio Projects and Visual Studio 2019 Platform Targeting and Compatibility.

但是,.NET 框架中的一些更改需要更改代碼。However, some changes in .NET Framework require changes to your code. 您也可能想要利用 .NET Framework 4.5 及其小數點版本、.NET Framework 4.6 及其小數點版本、.NET Framework 4.7 及其小數點版本或 .NET Framework 4.8 中的某些新功能。You may also want to take advantage of functionality that is new in .NET Framework 4.5 and its point releases, in .NET Framework 4.6 and its point releases, in .NET Framework 4.7 and its point releases, or in .NET Framework 4.8. 新增版本 .NET Framework 的應用程式進行這些類型的變更通常為移轉Making these types of changes to your app for a new version of .NET Framework is typically referred to as migration. 如果應用不必遷移,則可以在 .NET Framework 4.5 或更高版本中運行它,而無需重新編譯它。If your app doesn't have to be migrated, you can run it in .NET Framework 4.5 or a later version without recompiling it.

移轉資源Migration resources

將應用從早期版本的 .NET Framework 遷移到版本 4.5、4.5.1、4.5.2、4.6、4.6.1、4.6.2、4.6.2、4.7、4.7.1、4.7.2 或 4.8 之前,請查看以下文檔:Review the following documents before you migrate your app from earlier versions of .NET Framework to version 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, or 4.8:

  • 請參閱版本和相依性,了解每個 .NET Framework 版本的基礎 CLR 版本,並檢閱成功設定應用程式目標的方針。See Versions and Dependencies to understand the CLR version underlying each version of the .NET Framework and to review guidelines for targeting your apps successfully.

  • 查看應用程式相容性,瞭解可能影響應用的運行時更改和重新定位更改以及如何處理這些更改。Review Application compatibility to find out about runtime and retargeting changes that might affect your app and how to handle them.

  • 檢閱類別庫中已淘汰的功能,以判斷您的程式碼中可能已淘汰的任何類型或成員,以及建議的替代做法。Review What's Obsolete in the Class Library to determine any types or members in your code that have been made obsolete, and the recommended alternatives.

  • 如需想要新增至應用程式之新功能的描述,請參閱新功能See What's New for descriptions of new features that you may want to add to your app.

另請參閱See also