【问题标题】:msbuild 15 failing with missing targeting frameworkmsbuild 15 因缺少目标框架而失败
【发布时间】:2017-09-06 18:48:04
【问题描述】:

我为 Visual Studio 2017 (msbuild 15) 安装了构建工具,但在构建解决方案时遇到了问题。我在安装构建工具之前安装了框架(4.6.1),所以它存在。

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: 
The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. 
To resolve this, install the SDK or Targeting Pack for this framework version or 
retarget your application to a version of the framework for which you have the SDK or 
Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly 
Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly 
may not be correctly targeted for the framework you intend.

编辑:请注意,在这种情况下,我实际上是在尝试静默安装 msbuild;所以我无权访问用户界面。

【问题讨论】:

    标签: .net msbuild continuous-integration


    【解决方案1】:

    您可能安装了框架,但没有安装目标包/“开发者包”。您可以检查版本是否作为C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework 的子目录存在。

    您可以通过运行 Visual Studio 安装程序来安装缺少的支持,在您的 VS 2017 安装上单击“修改”,然后从“单个组件”中为您要构建的 .NET Framework 版本选择目标包和 SDK。

    【讨论】:

    • 在这种情况下,我正在尝试为客户端计算机进行静默安装——因此我无法实际访问 UI。
    • 您可以在docs.microsoft.com/en-us/visualstudio/install/…找到无人值守安装的组件ID
    • 我试图这样做;但它最终根本没有安装任何东西(安装进行了一段时间,完成后安装目录为空)我使用了“Start-Process -FilePath 'vs_BuildTools.exe' -ArgumentList '--quiet', '-- norestart', '--add Microsoft.Net.Component.4.6.1.TargetingPack', '--locale en-US' -Wait" in powershell
    猜你喜欢
    • 2014-08-10
    • 1970-01-01
    • 1970-01-01
    • 2015-09-27
    • 1970-01-01
    • 2019-11-09
    • 2022-12-13
    • 1970-01-01
    • 2016-10-03
    相关资源
    最近更新 更多