舊版架構已自套件內卸除

從 .NET 6 開始,Core 程式庫套件不可再安裝於目標架構早於下列版本的專案中:

  • .NET Framework 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 Framework 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.Hosting
  • 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.Reflection.MetadataLoadContext
  • 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