2016-04-28 145 views
0

設置: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終點事對於這樣的評論包?

回答

0

它取決於Visual Studio正在使用的Nuget客戶端版本,然後nuget客戶端需要特定版本的API用於消費,看起來更像是nuget客戶端版本,然後是vs版本。

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網址可能會有訣竅。

+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網址可能會有訣竅。 –