Nuget installer task failed in tfs 2017 builds

We use the Nuget installer step, which restores the missing nuget packages in the TFS assembly, this step fails with the following error:

E: \ Builds \ _tasks \ NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b \ 0.2.29 \ node_modules \ nuget-task-common \ NuGet \ 3.3.0 \ NuGet.exe restore -NonInteractive E: \ Builds \ test.sln Automatic MSBuild discovery: using msbuild version "3.5" from "C: \ Windows \ Microsoft.NET \ Framework \ v3.5". Error parsing the solution file in E: \ Builds \ test.sln: the system cannot find the specified file. (Exception from HRESULT: 0x80070002) Error: E: \ Builds \ Agent2017Update1_tasks \ NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b \ 0.2.29 \ node_modules \ nuget-task-common \ NuGet \ 3.3.0 \ nuuGet \ 3.3.0 return code: 1 packages failed to install

The error message seems confusing because the specified file is present in the build agent.

TFS Build Agent Version: 2.112.0 TFS Version: TFS 2017 Update 1

+4
source share
2 answers

This is because msbuild.exein your path (your build agent) it has version 3.5 . MSBuild 3.5 has two DLL files that nuget tries to dynamically load ( Microsoft.Build.dlland Microsoft.Build.Framework.dll).

To resolve this problem, please make sure that NuGet.exe is using MSBuild 4.0 or higher . This can be done by making sure that MSBuild 4.0 or higher first resolves your path or passing -msbuildversionoption. For example, use MSBuild 14.0 (which comes with Visual Studio 2015).

nuget.exe pack MyProj.csproj -msbuildversion 14.0

See this similar issue for more details. Nuget package error when MSBuild version is enabled for MSBuild 3.5

+1

NuGet 3.5. 2 , 3.3 , , 3.5 , .

enter image description here

, = D

+3

Source: https://habr.com/ru/post/1677601/


All Articles