簡體   English   中英

nuget未在Visual Studio Team Services下下載軟件包(visualstudio.com)(自動軟件包還原)

[英]nuget not downloaded packages under Visual Studio Team Services (visualstudio.com) (Automatic Package Restore)

我真的很瘋狂與nuget並在Visual Studio Team Services(visualstudio.com)下構建解決方案。 任何幫助都感激不盡。

我有一個包含36個項目的解決方案。 許多項目使用相同的5或6個nuget包。 我已仔細按照遷移MSBuild集成解決方案的說明使用自動包恢復 ,因此在我的解決方案文件夾下有一個.nuget文件夾,其中包含唯一的NuGet.Config文件,不再包含Nuget.exe或Nuget.targets文件。 所有項目都刪除了Nuget.targets行。

我正在使用Visual Studio 2013 Professional(v12 Update 2),並且本地構建的解決方案沒有錯誤或警告。 即使在清理並刪除packages文件夾之后,它也會下載並構建正常。 packages文件夾未在Visual Studio Team Services中簽入。

檢查構建日志表明:

  1. nuget在Build的開始沒有啟動,以便檢查,下載和解壓任何未解析的軟件包(它是在從MSBuild-Integrated遷移到自動軟件包恢復之前這樣做的 - 盡管如此,它無法解決參考)
  2. 我遺留了113個錯誤,主要是項目無法解析引用。
  3. 與本地構建(和MSBuild集成)不同,Visual Studio Team Services現在甚至不在其構建日志中提及 nuget!

事情開始失敗的日志示例(雖然這顯然是因為nuget沒有介入):

Project "C:\a\src\TFS\RSPlatform\Main\Source\RSPlatform Team Project.sln" (1) is building "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\A2Refresh.csproj" (8) on node 1 (default targets).
PrepareForBuild:
  Creating directory "obj\Release\".
ResolveAssemblyReferences:
  Primary reference "Bytescout.Spreadsheet".
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Bytescout.Spreadsheet". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\A2Refresh.csproj]
          For SearchPath "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies".
          Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.winmd", but it didn't exist.
          Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.dll", but it didn't exist.
          Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.exe", but it didn't exist.
          For SearchPath "{HintPathFromItem}".
          Considered "..\..\packages\Bytescout.Spreadsheet.2.4.0.1346\lib\net45\Bytescout.Spreadsheet.dll", but it didn't exist.
          For SearchPath "{TargetFrameworkDirectory}".
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.winmd", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.dll", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.exe", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.winmd", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.dll", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.exe", but it didn't exist.
          For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.5.1,AssemblyFoldersEx}".
          Considered AssemblyFoldersEx locations.
          For SearchPath "{AssemblyFolders}".

任何人都可以建議我如何讓Visual Studio Team Services使用nuget? 如果自動包恢復建議丟棄~/.nuget/NuGet.exe Visual Studio Team Services如何使用NuGet?

謝謝,克里斯

如果您正在構建Visual Studio Team Services,那么我發現Nuget.exe和Nuget.targets都需要存在,這似乎與通過Google搜索此主題可以找到的所有建議相反。

添加它們使我的Visual Studio Team Services構建工作。

在嘗試了很多東西后,我發現我使用了錯誤的默認模板。

我用的是:

DefaultTemplate.11.1.xaml

我的正確模板是:

TfvcTemplate.12.xaml

當我使用此模板時,構建從nuget恢復並正確完成

我沒有使用Visual Studio Team Services,但NuGet文檔聲稱默認情況下Package Restore應該是構建過程的一部分

對於Team Foundation Build 2013內部部署和Visual Studio Online(以前稱為Team Foundation Service),默認的構建過程模板已經實現了NuGet Package Restore工作流,無需任何特殊配置。 以下信息僅適用於Team Foundation Build 2012及更早版本,或者適用於已自定義並已刪除NuGet Restore功能的構建過程模板。

如果由於某種原因,您的構建過程不包括此步驟(看起來就是這種情況),您可能需要手動添加它。 博客文章詳細介紹了如何使用Team Services進行包還原。 它使用專用的構建文件和前一個鏈接中描述的過程。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM