1

I've configured a private build agent to use with VSTS.

I installed MSBuild tools and installed the agent as a service. Now I'm trying to build a MVC 5 project with it. The build fails in the Use Nuget 4.3.0 task. After queueing a new build with diagnostics, here are the last lines:

2018-04-04T18:58:46.7604184Z ##[debug]checking cache: C:\agent\_work\_tool\NuGet\4.3.0\x64
2018-04-04T18:58:46.7609109Z ##[debug]not found
2018-04-04T18:58:46.7613274Z ##[debug]Agent.Version=2.131.0
2018-04-04T18:58:46.7614366Z ##[debug]Agent.ToolsDirectory=C:\agent\_work\_tool
2018-04-04T18:58:46.7619860Z ##[debug]evaluating 0 versions
2018-04-04T18:58:46.7621212Z ##[debug]match not found
2018-04-04T18:58:46.7628225Z ##[debug]Querying versions list
2018-04-04T18:58:46.8585728Z ERR:unable to verify the first certificate
2018-04-04T18:58:46.8587980Z ##[debug]task result: Failed

So I get this message: unable to verify the first certificate.

My first thought was the firewall blocking the nuget.exe download, but if I connect to the server, I can manually download it from this link (I believe the task tries to download from here):

https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe

How to fix this problem?

Alisson Reinaldo Silva
  • 10,009
  • 5
  • 65
  • 83

1 Answers1

1

You can download the nuget.exe tool manually, then add it to the environment variable, simple steps:

  1. Download NuGet.exe tool to that agent machine manually (e.g. d:\tool\nuget.exe)
  2. Open System Properties window > Advance > Environment variables
  3. In System variables section, click New button > Variable name: nuget; Variable value: d:\tool > Click Ok
  4. Select Path variable > Edit > add/append %nuget% item (the result will be xxxx;%nuget%)
  5. Restart your machine

After that you can remove NuGet Tool Installer task from build definition.

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • After doing these steps, the build task could restore packages from NuGet and build the project, however the **Test Assemblies** task failed because it couldn't find Visual Studio 2015 (even though I installed VS Build Tools 2017). Then I added the **VsTest Platform Installer** before it, and it worked. The strange thing is the VsTest Platform Installer was able to download stuff, but the **Use NuGet task** wasn't, so I believe it's not a problem with the private server network. – Alisson Reinaldo Silva Apr 06 '18 at 11:44
  • 2
    You may open a new issue on [vsts-task github](https://github.com/Microsoft/vsts-tasks/issues) for vsts task issue. – starian chen-MSFT Apr 09 '18 at 06:54