2016-09-06 75 views
0

我有一個netstandard1.2項目具有以下project.json的NuGet無法還原NetStandard.Libary在生成代理netstandard1.2建立VS團隊服務

{ 
    "supports": {}, 
    "dependencies": { 
    "NETStandard.Library": "1.6.0" 
    }, 
    "frameworks": { 
    "netstandard1.2": {} 
    } 
} 

該項目包括包含在解決方案中。以4.5.1爲目標的.NET Framework項目(其他幾個項目都參考這個netstandard1.2項目,但該項目本身不引用任何其他項目)。

在Visual Studio 2015 Update 3(NuGet 3.5.0)中,一切恢復並生成正常,但當生成服務器(內部部署的團隊服務生成代理,更新到最新2.105.1)運行vNext步驟來還原包時該解決方案,我得到的錯誤:

Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'.

我所做的事情:

  • 的Visual Studio 2015年生成服務器上達最新到Update 3
  • 對.NET核心預覽工具安裝在版本上服務器
  • 最新的NuGet是構建服務器
  • 的NuGet恢復在vNext構建步驟上最晚的NuGet(而不是它隨團隊服務建立代理V3.3.0)
  • 成功地構建解決方案指向使用安裝在構建器服務器上的Visual Studio 2015年(VS過的NuGet 3.5.0擴展安裝)

有什麼我缺少什麼的,我可以試試嗎?

從的NuGet更詳細的輸出:

2016-09-06T14:28:43.0788201Z ##[debug] C:\BuildAgent\_work\17\s\.nuget\NuGet.Config 
2016-09-06T14:28:43.0798020Z [command]D:\nuget.exe restore -NonInteractive C:\BuildAgent\_work\17\s\MySolution.sln -ConfigFile C:\BuildAgent\_work\17\s\.nuget\NuGet.Config 
2016-09-06T14:28:43.4458345Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. 
2016-09-06T14:28:43.8138208Z All packages listed in packages.config are already installed. 
2016-09-06T14:28:43.8618591Z Restoring packages for C:\BuildAgent\_work\17\s\MyProject\project.json... 
2016-09-06T14:28:43.9588089Z Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'. 
2016-09-06T14:28:43.9848100Z Committing restore... 
2016-09-06T14:28:43.9898096Z Writing lock file to disk. Path: C:\BuildAgent\_work\17\s\MyProject\project.lock.json 
2016-09-06T14:28:44.0038195Z C:\BuildAgent\_work\17\s\MyProject\MyProject.csproj 
2016-09-06T14:28:44.0048116Z Restore failed in 163ms. 
2016-09-06T14:28:44.0108191Z Errors in C:\BuildAgent\_work\17\s\MyProject\MyProject.csproj 
2016-09-06T14:28:44.0108191Z  Unable to resolve 'NETStandard.Library (>= 1.6.0)' for '.NETStandard,Version=v1.2'. 
2016-09-06T14:28:44.0118109Z NuGet Config files used: 
2016-09-06T14:28:44.0118109Z  C:\BuildAgent\_work\17\s\.nuget\NuGet.Config 
2016-09-06T14:28:44.0268561Z ##[debug]rc:1 
2016-09-06T14:28:44.0278115Z ##[debug]success:false 
2016-09-06T14:28:44.0288120Z ##[error]Error: D:\nuget.exe failed with return code: 1 
2016-09-06T14:28:44.0298129Z ##[error]Packages failed to install 

更新:這是我的Nuget.Config

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <solution> 
    <add key="disableSourceControlIntegration" value="true" /> 
    </solution> 
</configuration> 
+0

您是否試過在沒有vNext步驟的情況下恢復軟件包?請直接使用VSO的構建器代理上的Visual Studio進行還原,這可以幫助我們確認此問題是由Visual Studio環境還是由vNext步驟引起的。 –

+0

@ Wendy是的,建立在安裝在構建器服務器(其VSO構建代理)上的VS中工作正常(安裝的VS具有NuGet 3.5.0擴展) – OffHeGoes

+0

我無法重現該問題,您是否可以共享設置您在還原任務中指定的NuGet.Config文件? –

回答

2

我設法重現您的問題清楚的NuGet高速緩存後,我的生成代理。解決此問題的解決方案不是在nuget restore任務中指定nuget.config文件,或是在nuget.config文件中添加nuget軟件包源。

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <solution> 
    <add key="disableSourceControlIntegration" value="true" /> 
    </solution> 
<packageSources> 
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> 
    </packageSources> 
</configuration> 
+0

謝謝。這似乎是有道理的,因爲我已經去除了我的''項目後NuGet 3.5.0解析包的問題。json'項目。我認爲這是一個需要日誌記錄的錯誤? – OffHeGoes

+0

@OffHeGoes是的,我同意你的意見。 –

+0

任何有關NuGet錯誤記錄的想法 - 我無法在GitHub上找到問題頁面? – OffHeGoes

相關問題