在 Windows Server 2016 上的 Visual Studio 安装程序中找不到 .NET Framework 4.7 目标包

Posted

技术标签:

【中文标题】在 Windows Server 2016 上的 Visual Studio 安装程序中找不到 .NET Framework 4.7 目标包【英文标题】:Can't find .NET Framework 4.7 targeting pack in Visual Studio Installer on Windows Server 2016 【发布时间】:2017-05-28 10:36:43 【问题描述】:

我们有一个 Windows Server 2016,带有一个用于 TFS 2017 更新 1 的构建代理,它使用 Visual Studio Entreprise 2017。

所有 Windows 更新已完成 我安装了 .NET 4.7 Runtime 和 .NET 4.7 Targeting Pack(我试过在线和离线) registery 中的键存在(见截图) 此文件夹存在 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7 我重新启动了 Visual Studio 安装程序 我重新安装了 Visual Studio 我重启了很多次

但我仍然看不到 .NET Framework 4.7 SDK 或 Visual Studio Installer > 单个组件中的目标包。

installation screenshot

一个可行的短期解决方案,将此参数添加到构建解决方案步骤

/p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7"

有没有人知道如何强制 .NET 4.7 被 Visual Studio 安装程序检测到?

【问题讨论】:

安装程序不知道 4.7 的 bean,而且在更新之前肯定永远不会知道。可能有一天会发生。完全不清楚为什么这很重要。目标包所做的只是为您提供在项目中选择 4.7 作为目标框架的选项。项目 > 属性 > 应用程序选项卡 > 目标框架组合框。 您找到解决方案了吗?我正在写一个安装 VS 2017 的小指南,我也没有看到这个选项(Windows 7)。 为什么要让 Visual Studio 安装程序检测到比它自己更新的东西? Microsoft 可能会更新这些位以支持 .NET 4.7,但这显然不是强制性的。 【参考方案1】:

我在装有最新 Visual Studio 2017 的 Windows Server 2016 上遇到了同样的问题。

通过安装解决了这个问题:https://www.microsoft.com/en-us/download/details.aspx?id=55168。

(适用于 Windows 7 SP1、Windows 8.1、Windows 10 周年更新、Windows Server 2008 R2 SP1、Windows Server 2012、Windows Server 2012 R2 和 Windows Server 2016 组合包的 Microsoft .NET Framework 4.7 开发人员包和语言包)。

【讨论】:

【参考方案2】:

安装所需 .NET Framework 的开发包,使其在 Visual Studio 中可见和可选择。

例如 .NET Framework 4.7.1 在 Visual Studio 2017 中对我来说是不可见的(尽管它已安装在我的机器上),所以我为 4.7.1 安装了开发人员包做了什么,它就像魔术一样工作。

【讨论】:

以上是关于在 Windows Server 2016 上的 Visual Studio 安装程序中找不到 .NET Framework 4.7 目标包的主要内容,如果未能解决你的问题,请参考以下文章

无法从 python-ldap 连接到 Windows Server 2016 上的 ldaps

使用 Git over OpenSSH 在 windows server 2016 上部署 repo

Docker Compose (docker-compose) 无法连接到 Windows Server 2016 TP5 上的 docker 守护进程

Windows Server 2016- Windows Server 2016 上 HYPER-V 中的新增功能

Windows Server 2016 Dockerfile 安装服务

Windows服务平台上的WCFNoSupportedException在Windows Server 2012 R2上