TFS 2015年OnPrem的NuGet还原错误

问题描述:

设置:TFS 2015年OnPrem的NuGet还原错误

  • TFS 2015年更新2
  • 构建代理是Windows 2012服务器
    • 的Visual Studio 2015年更新2上构建系统安装在运行

enter image description here

我有一个在安装了VS 2015 Update 2的代理上运行的构建(新)定义。我有一个项目中有几个NuGet包。直到今天下午,该构建按预期工作。我就其中它把完成后的建立一些变化,然后我就开始收到此错误:

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

现在,这是我迷路了,我检查NuGet.org和包,这个版本存在。我甚至在我的本地系统中删除了项目中的所有软件包,然后做了一个NuGet软件包还原,它工作得很好。我从项目中删除了NuGet包,并重新添加它,它工作正常。

有没有人看到这个,知道如何解决它?

更新时间29/4/2016: 正如我在下面的评论中所说,我已经整理出来了。 我原来nuget.config文件是这样的

<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> 

我改成了这一点,它的工作

<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> 

新的问题是,为什么这个API终点事对于这样的评论包?

它取决于Visual Studio正在使用的Nuget客户端版本,然后nuget客户端需要特定版本的API用于消费,看起来更像是nuget客户端版本,然后是vs版本。

根据你的错误信息,这可能是由你的工作目录上的构建代理引起的。由于您已经更改了放置版本的位置。这可能会导致错误。

您可以删除构建代理上的工作目录,并让它自动重新创建。然后再试一次。


更新

System.Reflection.Metadata 1.2.0只需要的NuGet 2.8.6或更高版本。对于NuGet feed v3(VS 2015/NuGet v3.x):https://api.nuget.org/v3/index.json和NuGet feed v2(VS 2013及更早版本/ NuGet 2.x):https://www.nuget.org/api/v2。由于您使用的是VS2015,因此添加V3网址可能会有诀窍。

+0

我昨天和今天多次这样做过,但最终在今天早上把它整理出来了,但这个解决方案比问题更不明智。我将更新问题以显示我找到的解决方案。 –

+0

System.Reflection.Metadata 1.2.0只需要NuGet 2.8.6或更高版本。对于NuGet feed v3(VS 2015/NuGet v3.x):https://api.nuget.org/v3/index.json和NuGet feed v2(VS 2013及更早版本/ NuGet 2.x):https:// www.nuget.org/api/v2。由于您使用的是VS2015,因此添加V3网址可能会有诀窍。 –