0
votes

Setup:

  • TFS 2015 Update 2
  • Build Agent is running on a Windows 2012 Server
    • Visual Studio 2015 Update 2 installed on Build System

enter image description here

I have a build (new) definition running on an agent that has VS 2015 Update 2 installed. I have a project that has several NuGet Packages in it. Up until this afternoon the build was working as expected. I made some changes on where it puts the builds when done and then I started getting this error:

2016-04-28T16:35:03.3605826Z Set workingFolder to default: E:\agent\tasks\NuGetInstaller\0.1.17

2016-04-28T16:35:03.4073604Z Executing the powershell script: E:\agent\tasks\NuGetInstaller\0.1.17\NuGetInstaller.ps1

2016-04-28T16:35:05.0948829Z Saving to E:\agent_work\1\NuGet\newNuGet.config

2016-04-28T16:35:05.1418632Z E:\agent\agent\worker\tools\NuGet.exe restore "E:\agent_work\1\s\Dev\eCommerce\Consol.eCommerce.sln" -NonInteractive -configfile "E:\agent_work\1\NuGet\newNuGet.config"

2016-04-28T16:35:05.8761260Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.

2016-04-28T16:35:06.6105618Z Restoring NuGet package System.Reflection.Metadata.1.2.0.

2016-04-28T16:35:08.9542747Z WARNING: Unable to find version '1.2.0' of package 'System.Reflection.Metadata'.

2016-04-28T16:35:09.0012648Z ##[error]Unable to find version '1.2.0' of package 'System.Reflection.Metadata'.

2016-04-28T16:35:09.0323998Z ##[error]Unexpected exit code 1 returned from tool NuGet.exe

Now this is where I get lost, I checked NuGet.org and the package and this version exist. I even went and removed all the packages in the project on my local system then did a NuGet Package Restore, and it worked just fine. I deleted the NuGet Package from the Project and re-added it and it worked fine.

Has anyone seen this and know how to fix it?

Updated 29/4/2016: So as I said in the comment below, I have sorted it out. My original nuget.config file was this

<configuration>
    <solution>
        <add key="disableSourceControlIntegration" value="true" />
    </solution>
  <packageSources>
    <add key="NuGet official package source v2" value="https://nuget.org/api/v2/" />
    <add key="FelineSoft NuGet" value="http://prod-tfs15:81/nuget" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

I changed it to this and it worked

<configuration>
    <solution>
        <add key="disableSourceControlIntegration" value="true" />
    </solution>
  <packageSources>
    <add key="NuGet official package source v3" value="https://api.nuget.org/v3/index.json" />
    <add key="NuGet official package source v2" value="https://nuget.org/api/v2/" />
    <add key="FelineSoft NuGet" value="http://prod-tfs15:81/nuget" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

The new question is, why does the API End-Point matter for such a comment package?

2

2 Answers

0
votes

It depends from what version of nuget client Visual studio is using and then nuget client is expecting specific version of api for consumption, look more like nuget client version then vs version.

0
votes

According to your error info, this may caused by your working directory on the build agent has changed. Since you have changed the location of where it put the builds. This may caused the error.

You can delete the working directory on the build agent and let it recreate automatically. Then try it again.


Update

System.Reflection.Metadata 1.2.0 only requires NuGet 2.8.6 or higher. For NuGet feed v3 (VS 2015 / NuGet v3.x): https://api.nuget.org/v3/index.json and for NuGet feed v2 (VS 2013 and earlier / NuGet 2.x): https://www.nuget.org/api/v2 . Since you are using VS2015, maybe adding the V3 url did the trick.