從套件中移除的舊框架版本

從 .NET 6 開始,核心程式庫套件無法再安裝到其目標框架版本早於下列的專案中:

  • .NET 框架 4.6.1
  • .NET Core 3.1
  • .NET Standard 2.0

變更描述

先前,即使從比 .NET Framework 4.6.1、.NET Core 3.1 或 .NET Standard 2.0 還舊的架構使用這些套件,您還是能夠將套件升級至最新版本。 從 .NET 6 開始,如果您從舊版架構參考受影響的套件,就無法再將參考的套件更新為最新版本。

推出的版本

.NET 6

變更的原因

繼續支援各種框架會增加套件的複雜度和大小。 過去,.NET 僅針對目前的架構建置並 收集 舊版架構的二進位檔,解決了此問題。 收集表示在建置期間,會下載舊版的套件,並擷取二進位檔。

雖然使用已編譯的二進位檔表示您可以隨時更新,而不必擔心架構被移除,但也表示您不會收到任何錯誤修正或新功能。 換句話說,已收穫的資產無法被管理或使用。 這是隱藏的,因為即使您耗用不再更新的舊二進位檔,您還是能夠繼續將套件更新為更新版本。

從 .NET 6 開始,.NET 不再執行任何形式的元件收集,以確保所有發佈的資產都能得到維護。

如果您的專案是維護但未演進的,就不要升級受影響的套件。 這通常不會造成重大問題,因為您已經在使用預先編譯的二進位檔案。

如果您的專案正在演進,請將它升級至較新的架構版本,例如:

  • .NET 框架 4.6.1
  • .NET Core 3.1
  • .NET Standard 2.0

受影響的 API

下列套件不再隨附舊架構:

  • Microsoft.Extensions.DependencyModel
  • Microsoft.Win32.Registry.AccessControl
  • Microsoft.Win32.SystemEvents
  • System.Collections.Immutable
  • System.ComponentModel.Annotations
  • System.ComponentModel.Composition
  • System.ComponentModel.Composition.Registration
  • System.Composition.AttributedModel
  • System.Composition.Convention
  • 系統.組成.主機
  • System.Composition.Runtime
  • System.Composition.TypedParts
  • System.Data.Odbc
  • System.Data.OleDb
  • System.Diagnostics.DiagnosticSource
  • System.Diagnostics.EventLog
  • System.Diagnostics.PerformanceCounter
  • System.DirectoryServices
  • System.DirectoryServices.AccountManagement (系統.目錄服務.帳戶管理)
  • System.DirectoryServices.Protocols
  • System.Drawing.Common
  • System.IO.Packaging
  • System.IO.Pipelines
  • System.Management(系統管理)
  • System.Net.Http.WinHttpHandler
  • System.Net.WebSockets.WebSocketProtocol
  • System.Numerics.Tensors
  • System.Reflection.Context
  • System.Reflection.Metadata
  • 系統反射元資料載入上下文
  • System.Runtime.Caching
  • System.Runtime.CompilerServices.Unsafe
  • System.Security.Cryptography.Cng
  • System.Security.Cryptography.OpenSsl
  • System.Security.Cryptography.Pkcs
  • System.Security.Cryptography.ProtectedData
  • System.Security.Permissions
  • System.ServiceProcess.ServiceController
  • System.Speech
  • System.Text.Encoding.CodePages
  • System.Text.Encodings.Web
  • System.Threading.AccessControl
  • System.Threading.Channels
  • System.Threading.Tasks.Dataflow
  • System.Windows.Extensions

下列套件將不再更新,因為其實作現在是 .NET 6 平臺的一部分:

  • Microsoft.Win32.Registry
  • System.ComponentModel.Annotations
  • System.IO.FileSystem.AccessControl
  • System.IO.Pipes.AccessControl
  • System.Security.AccessControl
  • System.Security.Cryptography.Cng
  • System.Security.Cryptography.OpenSsl
  • System.Security.Principal.Windows