.NET Core 3.1 的新功能What's new in .NET Core 3.1

本文說明 .NET Core 3.1 中的新功能。This article describes what is new in .NET Core 3.1. 此版本包含 .NET Core 3.0 的次要改良功能,著重于小型但重要的修正程式。This release contains minor improvements to .NET Core 3.0, focusing on small, but important, fixes. .NET Core 3.1 最重要的功能是,它是長期支援(LTS)版本。The most important feature about .NET Core 3.1 is that it's a long-term support (LTS) release.

如果您使用 Visual Studio 2019,您必須更新為Visual Studio 2019 16.4 版,才能使用 .net Core 3.1 專案。If you're using Visual Studio 2019, you must update to Visual Studio 2019 version 16.4 to work with .NET Core 3.1 projects. 如需 Visual Studio 新功能的詳細資訊,請參閱Visual Studio 2019 16.4 版的新功能For more information on what's new in Visual Studio, see What's New in Visual Studio 2019 version 16.4.

Visual Studio for Mac 也支援並包含 Visual Studio for Mac 8.4 中的 .NET Core 3.1。Visual Studio for Mac also supports and includes .NET Core 3.1 in Visual Studio for Mac 8.4.

如需版本的詳細資訊,請參閱.Net Core 3.1 公告For more information about the release, see the .NET Core 3.1 announcement.

長期支援Long-term support

.NET Core 3.1 是 LTS 版本,在接下來的三年來提供 Microsoft 支援。.NET Core 3.1 is an LTS release with support from Microsoft for the next three years. 強烈建議您將應用程式移至 .NET Core 3.1。It's highly recommended that you move your apps to .NET Core 3.1. 其他主要版本的目前生命週期如下所示:The current lifecycle of other major releases is as follows:

發行Release 附註Note
.NET Core 3.0.NET Core 3.0 2020年3月3日結束生命週期。End of life on March 3, 2020.
.NET Core 2.2.NET Core 2.2 2019年12月23日結束生命週期。End of life on December 23, 2019.
.NET Core 2.1.NET Core 2.1 2021年8月21日結束生命週期。End of life on August 21, 2021.

如需詳細資訊,請參閱.Net Core 支援原則For more information, see the .NET Core support policy.

Windows FormWindows Forms

僅限 WindowsWindows only

警告

Windows Forms 中有重大變更。There are breaking changes in Windows Forms.

舊版控制項已包含在 Visual Studio 設計工具工具箱中無法使用的 Windows Forms 中。Legacy controls were included in Windows Forms that have been unavailable in the Visual Studio Designer Toolbox for some time. 這些已取代為 .NET Framework 2.0 中的新控制項。These were replaced with new controls back in .NET Framework 2.0. 這些已從適用于 .NET Core 3.1 的桌面 SDK 移除。These have been removed from the Desktop SDK for .NET Core 3.1.

已移除控制項Removed control 建議取代Recommended replacement 已移除相關聯的 ApiAssociated APIs removed
DataGridDataGrid DataGridView DataGridCellDataGridCell
DataGridRowDataGridRow
DataGridTableCollectionDataGridTableCollection
DataGridColumnCollectionDataGridColumnCollection
DataGridTableStyleDataGridTableStyle
System.windows.forms.datagridcolumnstyle>DataGridColumnStyle
DataGridLineStyleDataGridLineStyle
DataGridParentRowsLabelDataGridParentRowsLabel
DataGridParentRowsLabelStyleDataGridParentRowsLabelStyle
DataGridBoolColumnDataGridBoolColumn
DataGridTextBoxDataGridTextBox
System.windows.forms.gridcolumnstylescollection>GridColumnStylesCollection
System.windows.forms.gridtablestylescollection>GridTableStylesCollection
HitTestTypeHitTestType
ToolBarToolBar ToolStrip System.windows.forms.toolbar.appearanceToolBarAppearance
ToolBarButtonToolBarButton ToolStripButton System.windows.forms.toolbarbuttonclickeventargs>ToolBarButtonClickEventArgs
ToolBarButtonClickEventHandlerToolBarButtonClickEventHandler
ToolBarButtonStyleToolBarButtonStyle
ToolBarTextAlignToolBarTextAlign
ContextMenuContextMenu ContextMenuStrip
Menu ToolStripDropDown
ToolStripDropDownMenu
MenuItemCollectionMenuItemCollection
MainMenuMainMenu MenuStrip
MenuItemMenuItem ToolStripMenuItem

我們建議您將應用程式更新為 .NET Core 3.1,並移至取代控制項。We recommend you update your applications to .NET Core 3.1 and move to the replacement controls. 取代控制項是直接的程式,基本上是「尋找和取代」類型。Replacing the controls is a straightforward process, essentially "find and replace" on the type.

C++/CLIC++/CLI

僅限 WindowsWindows only

已新增建立C++/cli (也稱為「受控C++」)專案的支援。Support has been added for creating C++/CLI (also known as "managed C++") projects. 從這些專案產生的二進位檔與 .NET Core 3.0 和更新版本相容。Binaries produced from these projects are compatible with .NET Core 3.0 and later versions.

若要在 Visual Studio C++2019 16.4 版中新增對/cli 的支援,請使用C++工作負載安裝桌面開發To add support for C++/CLI in Visual Studio 2019 version 16.4, install the Desktop development with C++ workload. 此工作負載會在 Visual Studio 中新增兩個範本:This workload adds two templates to Visual Studio:

  • CLR 類別庫(.NET Core)CLR Class Library (.NET Core)
  • CLR 空專案(.NET Core)CLR Empty Project (.NET Core)

後續步驟Next steps