不接受MSBuild 15工具版本 [英] MSBuild 15 Tools Version not accepted

查看:428
本文介绍了不接受MSBuild 15工具版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在构建服务器上安装了Visual Studio 2017的MSBuild(15.4.0)工具.为此,我使用了 Visual Studio下载 中的标题为"Visual Studio 2017的生成工具"的链接. >

MSBuild.exe的路径是:

C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ BuildTools \ MSBuild \ 15.0 \ Bin

我已将此路径添加到环境变量'path'.

我有一个powershell脚本,其中以下内容作为构建任务的主体:

msbuild'.. \ MyApplication.sln'/t:构建/tv:15.0 /p:GenerateBuildInfoConfigFile = false/p:Configuration =发布 /p:RunCodeAnalysis =真/p:VisualStudioVersion=15.0

但是,当执行此命令(全部由TeamCity处理)时,我在LOG中找到以下内容:

MSBUILD:错误MSB1040:ToolsVersion无效.工具版本 无法识别"15.0".可用的工具版本为"2.0","3.5", "4.0".

文档建议15.0应该是正确的.

编辑新功能的2017年文档中在MSBuild 15中指出:

此工具版本的

MSBuildToolsVersion为15.0.这 程序集版本为15.1.0.0.

但是,2017年文档 MSBuild命令行参考状态:

对于MSBuild 4.5 ,您可以为版本指定以下值: 2.0、3.5和4.0.如果指定4.0,VisualStudioVersion构建属性将指定要使用的子工具集.有关更多信息,请参见 工具集(ToolsVersion)的子工具集"部分.

所以我对命名法有些困惑:MSBuild 15或MSBuild 4.5 ...?

解决方案

我终于找到了解决方法.这是不正确的路径.

解决方案是将上面的powershell行更改为:

$msbuild = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe'
    & msbuild '..\MyApplication.sln' /t:Build /m /p:GenerateBuildInfoConfigFile=false /p:Configuration=Release /p:RunCodeAnalysis=True /p:VisualStudioVersion=15.0

I have installed the MSBuild (15.4.0) tools for Visual Studio 2017 on a build server. To do this I used the link entitled "Build Tools for Visual Studio 2017" from Visual Studio Downloads

The path to the MSBuild.exe is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin

I have added this path to the Environment Variable 'path'.

I have a powershell script with the following as the body for the build task:

msbuild '..\MyApplication.sln' /t:Build /tv:15.0 /p:GenerateBuildInfoConfigFile=false /p:Configuration=Release /p:RunCodeAnalysis=True /p:VisualStudioVersion=15.0

But, when this is executed (all handled by TeamCity) I find the following in the LOG:

MSBUILD : error MSB1040: ToolsVersion is not valid. The tools version "15.0" is unrecognized. Available tools versions are "2.0", "3.5", "4.0".

The documentation suggests 15.0 should be correct.

EDIT From the 2017 documentation on What's New in MSBuild 15 it states:

MSBuildToolsVersion for this version of the tools is 15.0. The assembly version is 15.1.0.0.

However, the 2017 documentation MSBuild Command Line Reference states:

For MSBuild 4.5, you can specify the following values for version: 2.0, 3.5, and 4.0. If you specify 4.0, the VisualStudioVersion build property specifies which sub-toolset to use. For more information, see the Sub-toolsets section of Toolset (ToolsVersion).

So I'm a bit confused by the nomenclature: MSBuild 15 or MSBuild 4.5...?

解决方案

I finally found a fix. It was the path that was incorrect.

The solution was to change the powershell line above to:

$msbuild = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe'
    & msbuild '..\MyApplication.sln' /t:Build /m /p:GenerateBuildInfoConfigFile=false /p:Configuration=Release /p:RunCodeAnalysis=True /p:VisualStudioVersion=15.0

这篇关于不接受MSBuild 15工具版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆