Simon_Weaver
Simon_Weaver

Reputation: 146180

TFS build for dotnetcore app failing with missed packages

I have a new TFS build setup using the new nuget installer build step but I get all kinds of errors as if packages are missing.

I checked in c:\users\USERNAME\.nuget\packages and yes they are mostly missing. Why are they not being restored?

I am using an agent from the latest version of TFS Express 2015 that I only just download a couple days ago with all the final RTM bits and VS2015 installed on the build server.

RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.AspNetCore.Hosting.Abstractions >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.AspNetCore.Hosting.Server.Abstractions >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.AspNetCore.Http.Abstractions >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.AspNetCore.Http.Features >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.EntityFrameworkCore >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (8, 76) The dependency Microsoft.EntityFrameworkCore >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (5, 69) The dependency Microsoft.EntityFrameworkCore >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.EntityFrameworkCore.Design >= 1.1.0-preview1-final could not be resolved. RR.CRM\RR.CRM.EF\project.json (9, 66) The dependency Microsoft.EntityFrameworkCore.Relational >= 1.1.0-preview1-final could not be resolved.

Upvotes: 0

Views: 93

Answers (1)

Simon_Weaver
Simon_Weaver

Reputation: 146180

If you look at the build logs you'll see the actual command being run for the nuget restore command (note: the package restore option under the Visual Studio step is deprecated and should be OFF).

The command will be something like this - i.e. just a call to nuget.exe restore

C:\BUILD-AGENT\agent\worker\tools\NuGet.exe restore "C:\BUILD-AGENT\_work\1\s\RR.CRM\RR.CRM.sln"  -NonInteractive

If this isn't actually doing anything then you probably have an old version of nuget installed.

The build agent installs its own version of nuget and for whatever reason that isn't being updated.

C:\BUILD-AGENT\Agent\Worker\Tools\nuget.exe

Solution:

If you run the following command it should update and then the restore command will work.

PS C:\BUILD-AGENT>  C:\BUILD-AGENT\agent\worker\tools\NuGet.exe update -self 

Checking for updates from https://www.nuget.org/api/v2/.

Currently running NuGet.exe 3.2.1.

Updating NuGet.exe to 3.4.4-rtm-final. Update successful.

Could be related to this: https://github.com/NuGet/Home/issues/1227

Upvotes: 1

Related Questions