针对.NET 6与Windows Server 2016的TFM及目标OS版本选择咨询
.NET 6 与 Windows Server 2016 相关 TFM 及版本映射问题解答
1. .NET 6 适配 Windows Server 2016 的 TFM
针对 Windows Server 2016(版本1607),对应的.NET 6目标框架名字(TFM)是 net6.0-windows10.0.14393.0。
2. Visual Studio 2022 中找不到 Windows Server 2016 版本号的解决办法
Visual Studio 2022 的项目属性窗口默认不会列出所有旧版 Windows 版本选项。若需适配 Windows Server 2016,可直接手动编辑项目文件(.csproj),将 TargetFramework 或 TargetPlatformVersion 字段设置为 10.0.14393.0。示例配置如下:
<PropertyGroup> <TargetFramework>net6.0-windows10.0.14393.0</TargetFramework> </PropertyGroup>
3. Windows 操作系统名称与内部版本号的对应映射
存在官方标准映射关系,结合你提到的可选值,相关对应项如下:
- Windows Server 2016(版本1607):
10.0.14393.0 - Windows 7:
7.0 - Windows 8:
8.0 - Windows Server 2019 / Windows 10 1809:
10.0.17763.0 - Windows 10 1903 / 1909:
10.0.18362.0 - Windows 10 2004 / 20H2 / 21H1:
10.0.19041.0 - Windows Server 2022:
10.0.20348.0 - Windows 11 21H2:
10.0.22000.0 - Windows 11 22H2:
10.0.22621.0
4. 目标OS版本可选值的补充说明
你当前看到的可选值是Visual Studio默认提供的较新版本选项,旧版本如10.0.14393.0不在下拉列表中,需通过手动修改项目文件添加。
5. 权威参考内容说明
微软官方文档明确了.NET目标框架命名规则、Windows版本与内部版本号的对应关系,以及OS特定TFM的定义和使用方法。可通过微软官方文档库搜索「.NET Target Framework Names」「Windows OS Version Numbers」获取完整权威内容。
内容的提问来源于stack exchange,提问作者Siva Sankaran
相关产品推荐
相关产品推荐

