从 .NET 6 开始,核心库包不能再安装到目标框架早于以下的项目:
- .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 通过仅为当前框架生成并为较旧框架收集二进制文件来解决此问题。 “获取”意味着在生成期间,下载包的早期版本并提取二进制文件。
虽然使用已收获的二进制文件意味着你始终可以更新而不担心框架被删除,但也意味着你不会得到任何 bug 修复或新功能。 换句话说,无法为已获取的资产提供服务。 这对你隐藏,因为即使使用不再更新的旧二进制文件,也能够将包更新到更高版本。
从 .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