背景
项目的.NET Framework需要升级到4.8
安装.NET Framework 4.8的开发者工具包时报错
原因
- 没有安装.NET Framework 4.8开发者工具包的先决条件,需要安装.NET Framework 4.6.2-4.8以下版本的开发者工具包后 才能安装4.8
- 你的电脑已经安装了.NET Framework 4.8开发者工具包
方案
如果是缺少安装.NET Framework 4.8开发者工具包的先决条件,那就先安装先决条件,如安装.NET Framework 4.6.2的开发者工具包
再安装.NET Framework 4.8的开发者工具包
又失败了 说明我的的电脑已经装过4.8了
创建一个.NET Framework 4.8版本的项目 证明4.8安装过了
呐 框架下拉选项中有4.8
项目正常创建了
Release版本识别.NET Framework版
官网:确定已安装的 .NET Framework 版本 - .NET Framework | Microsoft Learn
计算机上安装的 .NET Framework 版本(4.5 及更高版本)列出在注册表中,位于 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full。 如果缺少 Full 子项,则未安装 .NET Framework 4.5 或更高版本
注册表中的 Release REG_DWORD 值代表已安装的 .NET Framework 版本
.NET Framework 版本 | Release 的值 |
---|---|
.NET Framework 4.5 | 所有 Windows 操作系统:378389 |
.NET Framework 4.5.1 | 在 Windows 8.1 和 Windows Server 2012 R2 上:378675 在所有其他 Windows 操作系统上:378758 |
.NET Framework 4.5.2 | 所有 Windows 操作系统:379893 |
.NET Framework 4.6 | 在 Windows 10 上:393295 在所有其他 Windows 操作系统上:393297 |
.NET Framework 4.6.1 | 在 Windows 10 11 月更新系统上:394254 在所有其他 Windows 操作系统(包括 Windows 10)上:394271 |
.NET Framework 4.6.2 | 在 Windows 10 周年更新和 Windows Server 2016 上:394802 在所有其他 Windows 操作系统(包括其他 Windows 10 操作系统)上:394806 |
.NET Framework 4.7 | 在 Windows 10 创意者更新上:460798 在所有其他 Windows 操作系统(包括其他 Windows 10 操作系统)上:460805 |
.NET Framework 4.7.1 | 在 Windows 10 Fall Creators Update 和 Windows Server 版本 1709 上:461308 在所有其他 Windows 操作系统(包括其他 Windows 10 操作系统)上:461310 |
.NET Framework 4.7.2 | 在 Windows 10 2018 年 4 月更新和 Windows Server 版本 1803 上:461808 在除 Windows 10 2018 年 4 月更新和 Windows Server 版本 1803 之外的所有 Windows 操作系统上:461814 |
.NET Framework 4.8 | 在 Windows 10 的 2019 年 5 月更新和 Windows 10 的 2019 年 11 月更新上:528040 在 Windows 10 的 2020 年 5 月更新、2020 年 10 月更新、2021 年 5 月更新、2021 年 11 月更新和 2022 年更新上:528372 在 Windows 11 和 Windows Server 2022 上:528449 在所有其他 Windows 操作系统(包括其他 Windows 10 操作系统)上:528049 |
.NET Framework 4.8.1 | 在 Windows 11 2022 更新和 Windows 11 2023 更新上:533320 所有其他 Windows 操作系统:533325 |
打开注册表 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
我Release版本号 528049 和官网说明吻合 说明已经安装过了