如何为TeamCity NuGet安装程序设置MSBuild版本?

Ser*_*pin 5 msbuild teamcity nuget .net-core

我正在尝试使用NuGet Installer TeamCity构建步骤为.NET Core解决方案还原NuGet软件包。“ MSBuild自动检测”选择MSBuild v4.0而不是.NET Core项目所需的v15.0:

[15:41:53][restore] Starting NuGet.exe 4.1.0.2450 from C:\TeamCity\buildAgent\tools\NuGet.CommandLine.4.1.0\tools\NuGet.exe
[15:41:53][restore] MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319'.
[15:41:53][restore] Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
[15:41:53][restore] Process exited with code 0
Run Code Online (Sandbox Code Playgroud)

这会导致软件包还原后运行的“ MSBuild” TeamCity步骤中的编译错误:

Assets file 'C:\TeamCity\...\MyProj\obj\project.assets.json' not found.
Run a NuGet package restore to generate this file.
Run Code Online (Sandbox Code Playgroud)

对于“ MSBuild” TeamCity步骤,我按照此SO答案中所述手动选择MSBuildTools版本: 在此处输入图片说明

但是我没有为'NuGet Installer'步骤找到类似的设置。我想念什么吗?

Ser*_*pin 6

我设法克服了这一问题,指定了-MSBuildPath 命令行参数

在此处输入图片说明

  • 对于那些喜欢复制和粘贴的人``-MSBuildPath "%MSBuildTools15.0_x64_Path%"`` (4认同)