3
votes

Using AzureDevOps I should be able to restore packages from the feeds hosted within AzureDevOps. The Nuget.config seems correct, the build has access to the feed, locally it runs fine with explicitly using the same config file.

I've seen VSTS Build vNext NuGet custom package source but would very much like to stay out of adding apikey's there. The official documentation states it should be possible: https://www.visualstudio.com/docs/package/get-started/build/team-build

NuGet.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Net2Library" value="https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/yyy/nuget/v3/index.json" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

Feed settings enter image description here

Restore settings (it uses the correct config, visible from listing the feed in the logs)

enter image description here

Relevant logs:

2016-07-30T12:33:37.8085538Z Restoring NuGet package XYZ.2016.7.29.14.
2016-07-30T12:33:42.6885539Z Unable to find version '2016.7.29.14' of package 'XYZ'.
2016-07-30T12:33:42.6915543Z Feeds used:
2016-07-30T12:33:42.6925542Z   C:\Users\buildguest\AppData\Local\NuGet\Cache
2016-07-30T12:33:42.6925542Z   C:\Users\buildguest\.nuget\packages\
2016-07-30T12:33:42.6925542Z   https://api.nuget.org/v3/index.json
2016-07-30T12:33:42.6935552Z   https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/yyy/nuget/v3/index.json
2016-07-30T12:33:42.7235541Z ##[debug]rc:1
2016-07-30T12:33:42.7245545Z ##[debug]success:false
2016-07-30T12:33:42.7325527Z ##[error]Error: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.103.1\agent\Worker\Tools\nuget.exe failed with return code: 1
2016-07-30T12:33:42.7335525Z ##[error]Packages failed to install
2016-07-30T12:33:42.7335525Z ##[debug]task result: Failed
2016-07-30T12:33:42.7345538Z ##[error]Return code: 1
2
I'm having a similar problem - started last night stackoverflow.com/questions/38679316 . I now wonder if its me or them.rism
@rism interesting! I didn't get more detail out of my logs, but have been having this issue for a while (not recently), although I've only this week been giving it more attention and changed a couple of settings that might cause to 'work now' but possibly having the same issue as you. I'll track your issue too and post updates here if any.janpieter_z

2 Answers

0
votes

I'm having the exact same issue. I've been experiencing the error most of the times when the build starts from a push from the local repo (either from VS 2015 or git bash).
The workaround for me has been to queue a build directly on VSTS build definition, through "Queue Build.
It's annoying but it's the only way I found to overcome the issue. I do think this is a bug and hope MS fix it. Hope my workaround helps.