net6支持的windows版本

Posted China soft

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了net6支持的windows版本相关的知识,希望对你有一定的参考价值。

微软官方文档:

https://learn.microsoft.com/zh-cn/dotnet/core/install/windows?tabs=net60

 

操作系统.NET 7.NET 6.NET Core 3.1
Windows 11 ✔️ ✔️ ✔️
Windows Server 2022 ✔️ ✔️ ✔️
Windows Server 版本 1903 或更高版本 ✔️ ✔️ ✔️
Windows 10 版本 1607 或更高版本 ✔️ ✔️ ✔️
Windows 8.1 ✔️ ✔️
Windows 7 SP1 ESU ✔️ ✔️
Windows Server 2019
Windows Server 2016
Windows Server 2012 R2
Windows Server 2012
✔️ ✔️  
Windows Server Core 2012 R2 ✔️ ✔️ ✔️
Windows Server Core 2012 ✔️ ✔️ ✔️
Nano Server 版本 1809+ ✔️ ✔️ ✔️
Nano Server 版本 1803 ✔️

.NET 6 支持下列 Windows 版本:
(OS)-------------------------------------Version-----------------------体系结构
Windows 11---------------------------21H2--------------------------x64、Arm64
Windows 10 客户端 -----------------1607±-----------------------x64、x86、Arm64
Windows 客户端----------------------7 SP1+、8.1---------------x64、x86
Windows Server----------------------2012±-----------------------x64、x86
Windows Server 核心---------------2012±-----------------------x64、x86
Nano Server---------------------------1809±-----------------------X64

如果要在以下 Windows 版本上安装 .NET SDK 或运行时,则需要其他依赖项:
WINDOWS 7 / VISTA / 8.1 / SERVER 2008 R2 / SERVER 2012 R2

操作系统 先决条件
Windows 7 SP1 ESU - Microsoft Visual C++ 2015-2019 Redistributable 64 位 / 32 位 - KB3063858 64 位 / 32 位 - Microsoft 根证书颁发机构 2011(仅限 .NET Core 2.1 脱机安装程序)
Windows Vista SP 2 Microsoft Visual C++ 2015-2019 Redistributable 64 位 / 32 位
Windows 8.1 Microsoft Visual C++ 2015-2019 Redistributable 64 位 / 32 位
Windows Server 2008 R2 Microsoft Visual C++ 2015-2019 Redistributable 64 位 / 32 位
Windows Server 2012 Microsoft Visual C++ 2015-2019 Redistributable 64 位 / 32 位
Windows Server 2012 R2 Microsoft Visual C++ 2015-2019 Redistributable 64 位 / 32 位
Microsoft Visual C++ 2015-2019 Redistributable 64 位 https://aka.ms/vs/16/release/vc_redist.x64.exe
Microsoft Visual C++ 2015-2019 Redistributable 32 位 href="https://aka.ms/vs/16/release/vc_redist.x86.exe

KB3063858 64 https://www.microsoft.com/download/details.aspx?id=47442
KB3063858 32 https://www.microsoft.com/download/details.aspx?id=47409

Microsoft 根证书颁发机构 2011 https://www.microsoft.com/pkiops/Docs/Repository.htm

如果收到与以下 dll 之一相关的错误,也需要满足上述要求:


api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-cor-timezone-l1-1-0.dll
hostfxr.dll
————————————————
版权声明:本文为CSDN博主「香煎三文鱼」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_39569480/article/details/127229526

不支持在面向 .NET 5 或更高版本时直接引用 Windows 元数据组件

【中文标题】不支持在面向 .NET 5 或更高版本时直接引用 Windows 元数据组件【英文标题】:Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported 【发布时间】:2021-12-07 20:00:06 【问题描述】:

我有一个 .Net5.0 C# 类库项目,它构建得很好,但是在将目标框架更改为 <TargetFramework>net6.0</TargetFramework> 后,构建开始失败并显示以下错误消息:

C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.AI.MachineLearning.MachineLearningContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Activation.ActivatedEventsContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Activation.ActivationCameraSettingsContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Activation.ContactActivatedEventsContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Activation.WebUISearchActivatedEventsContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Background.BackgroundAlarmApplicationContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Calls.Background.CallsBackgroundContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Calls.CallsPhoneContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Calls.CallsVoipContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Calls.LockScreenCallContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.CommunicationBlocking.CommunicationBlockingContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.FullTrustAppContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Preview.InkWorkspace.PreviewInkWorkspaceContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Preview.Notes.PreviewNotesContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Resources.Management.ResourceIndexerContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Search.Core.SearchCoreContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1003,5): error NETSDK1130: Windows.ApplicationModel.Search.SearchContract.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
...

现在即使将配置恢复为<TargetFramework>net5.0</TargetFramework>,问题仍然存在。请注意,我正在使用 Visual Studio 2019 并已安装 .Net6.0 SDK。这是csproj 文件:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Ben.Demystifier" Version="0.1.4" />
    <PackageReference Include="BundlerMinifier.Core" Version="3.2.449" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.6.1" />
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.1.1" />
    <PackageReference Include="Microsoft.Identity.Client" Version="4.30.1" />
    <PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="4.5.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
    <PackageReference Include="Synergix.WE.ComputerManagement" Version="2.4.34" />
  </ItemGroup>

  <ItemGroup>

更新:

&lt;PackageReference Include="Synergix.WE.ComputerManagement" Version="2.4.34" /&gt; 是使用.netStandard2.1 构建的,当从引用中删除它时,错误消失了,但是由于内部依赖,构建失败,是否不可能在.net6 项目中引用.netStandard 库?

【问题讨论】:

【参考方案1】:

解决方案:

1 - 将 TargetFramework 设置为 &lt;TargetFramework&gt;net6.0-windows$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))&lt;/TargetFramework&gt;

2 - 添加对 CsWinRT&lt;PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.4.1" /&gt; 的包引用

【讨论】:

以上是关于net6支持的windows版本的主要内容,如果未能解决你的问题,请参考以下文章

为啥会创建“net6.0-windows”子文件夹?

net5和net6代码一样吗

不支持在面向 .NET 5 或更高版本时直接引用 Windows 元数据组件

.NET6打包部署到Windows Service

System.Drawing.Common workaround in .NET6

#yyds干货盘点#.NET6新东西--struct优化