Chris Surfleet
Chris Surfleet

Reputation: 2482

Nuget restore fails on VSO 2017 build for CORE packages

I have previously created and built a simple .net core nuget package and pushed it to our internal nuget (hosted inside our VSO). Now I wanted to reference it from another core project. This worked fine locally.

I then go onto defining my build. Here are the details:

When I run the build I get this error on the Nuget Installer bit:

[command]C:\a\_tasks\....\NuGet\3.5.0\NuGet.exe restore -NonInteractive C:\a\1\s\...sln -ConfigFile C:\a\1\s\...\nuget.config
Failed to load msbuild Toolset
Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 

Things I've Tried:

Thanks for any help!

Upvotes: 2

Views: 1324

Answers (2)

Marina Liu
Marina Liu

Reputation: 38096

You need to use NuGet 4.0 instead of 3.5 since your project is based on VS2017.

Now NuGet 4.0 is available for NuGet Installer task, so you can select the version directly and needn’t checkin the version to your source code.

enter image description here

For some VSTS accounts don't show nuget 4.0, I creates a new issue here, you can follow up.

Another way to use NuGet 4.0 for TFVC project:

  1. Checkin the nugget 4.0 in source code, such as nuget4.0.exe.
  2. In Get source step, map nuget4.0.exe.

enter image description here

  1. In nugget installer task, specify nugget.exe path as $(build.sourcesDirectory)/nuget4.0.exe.

enter image description here

Upvotes: 3

Steve R.
Steve R.

Reputation: 165

I had this issue too and found this thread.

After reviewing Marina's comments, I was able to get it working. All I did was alter the path based on the comments.

$(Build.SourcesDirectory)\Builds\Tools\nuget.exe

Upvotes: 1

Related Questions