Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the MSBuild verision for TeamCity NuGet Installer?

I'm trying to restore NuGet packages for a .NET Core solution using NuGet Installer TeamCity build step. The 'MSBuild auto-detection' chooses MSBuild v4.0 instead of v15.0 which is required for .NET Core projects:

[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

This leads to the compilation error in the 'MSBuild' TeamCity step that runs after the package restoring:

Assets file 'C:\TeamCity\...\MyProj\obj\project.assets.json' not found.
Run a NuGet package restore to generate this file.

For the 'MSBuild' TeamCity step I choose the MSBuildTools version manually as described in this SO answer: enter image description here

But I didn't manage to find the similar setting for the 'NuGet Installer' step. Am I missing something?

like image 378
Serhii Shushliapin Avatar asked Jun 13 '17 13:06

Serhii Shushliapin


People also ask

What is MSBuild in TeamCity?

The MSBuild runner generates an MSBuild script that includes the user's script. This script is used to add TeamCity-provided MSBuild tasks. Your MSBuild script will be included with the <Import> task. If you specified a Visual Studio solution file, it will be called from the <MSBuild> task.

Does MSBuild restore Nuget packages?

Restore by using MSBuildYou can use msbuild -t:restore to restore packages in NuGet 4. x+ and MSBuild 15.1+, which are included with Visual Studio 2017 and higher. This command restores packages in projects that use PackageReference for package references.

How do I update Nuget EXE?

Use nuget update -self on Windows to update an existing nuget.exe to the latest version. The latest recommended NuGet CLI is always available at https://dist.nuget.org/win-x86-commandline/latest/nuget.exe .


1 Answers

I managed to overcome this specifying the -MSBuildPath command line parameter:

enter image description here

like image 131
Serhii Shushliapin Avatar answered Sep 20 '22 09:09

Serhii Shushliapin