2014-06-12 52 views
6

我真的很想在這裏用nuget和Visual Studio Team Services(visualstudio.com)構建一個解決方案。任何幫助都感激不盡。nuget未下載Visual Studio Team Services(visualstudio.com)下的軟件包(自動修復包)

我有一個包含36個項目的解決方案。許多項目使用相同的5或6個nuget軟件包。我仔細地遵循了Migrating MSBuild-Integrated solutions to use Automatic Package Restore的說明,因此在我的解決方案文件夾下有一個.nuget文件夾,其中包含一個NuGet.Config文件,不再包含Nuget.exe或Nuget.targets文件。所有項目都刪除了它們的Nuget.targets行。

我使用的是Visual Studio 2013 Professional(v12 Update 2),解決方案在本地生成,沒有錯誤或警告。即使在清理並刪除軟件包文件夾後,它也會下載並生成。包文件夾不會被簽入Visual Studio Team Services。

檢查構建日誌表明:

  1. 的NuGet沒有在建造開始,以檢查,下載並解壓任何未解決的包從MSBuild-遷移之前踢(有人這樣做集成到自動軟件包還原 - 儘管如此,它不能解決引用)
  2. 我剩下113錯誤,集中在項目無法解決引用的事實。
  3. 與本地構建(和MSBuild集成)不同,Visual Studio團隊服務現在甚至不提供提及 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團隊服務使用的NuGet? 如果自動包恢復建議刪除~/.nuget/NuGet.exe,Visual Studio Team Services甚至會如何使用NuGet?

由於提前, 克里斯

+0

你有沒有想出解決出來嗎?我有大約12小時的試用和錯誤沒有運氣。答案中的鏈接指出,VSO的默認工作流程應該已經處理了這個問題,但是我已經打開它並確認nuget包恢復未實現。 –

+0

嗨鬆餅人, 我沒有。 @ probackpacker的迴應確實有助於讓nuget開始啓動並執行包恢復過程,但是當它繼續構建解決方案/項目時,相關項目仍然無法找到程序集。看我的日誌文件(6月26日在9:09),我已經有多遠了。 –

+0

這是**不**好。我坐在一個比你的30多個項目更簡單的設置,我仍然可以再現這種愚蠢的不端行爲!我有一個(1!)文件,* Program.cs *的控制檯應用程序。所有的工作都很好,直到我添加了NuGet的任何東西 - 我嘗試了EF和nUnit。然後 - 噗!什麼都沒有了。我不認爲這是不可能解決的,只是MS的一個非常愚蠢的設置。任何提示? –

回答

1

我沒有使用Visual Studio團隊服務,但NuGet docs聲稱包還原應該默認

對於團隊基礎構建2013是構建過程的一部分內部部署和Visual Studio Online (以前稱爲Team Foundation Service),默認的構建過程 模板已經實現了NuGet包恢復工作流程,沒有 任何特殊配置。以下信息僅適用於 Team Foundation Build 2012及更早版本,或者適用於已定製且已刪除NuGet Restore功能 的構建流程模板 。

如果出於某種原因,您的構建過程不包括此步驟(您可能需要手動添加)。此blog post詳細說明如何使用Team Services進行包恢復。它使用專用的構建文件和上一個鏈接中描述的過程。

+0

你好probackpacker。今天晚上我剛從假期回來。初步瞭解您的答案看起來很有希望,但我會找些時間閱讀您提供的鏈接,並在我的腦海中清楚地說明。一旦我完成了這個工作,我會報告回來。乾杯。 –

+0

我讀過你提供的非常有用的博客文章,並將NuGet.exe添加到工具文件夾中,並創建了一個msbuild項目,在構建解決方案之前進行NuGet恢復。 我可以看到現在正在恢復的軟件包,然而對於一些瘋狂的原因,主編譯仍然無法解析程序集!不幸的是,即使在一個詳細的構建日誌中,包的構建路徑也沒有明確報告。我試過改變我的msbuild.proj的「outdir」,但仍然沒有得到解決方案發生。有任何想法嗎?謝謝。 –

+0

這裏是我的生成日誌: https://dl.dropboxusercontent.com/u/26079253/build%28C874%29.log –

4

如果您在Visual Studio Team Services上構建,那麼我發現Nuget.exe和Nuget都是。目標需要存在,這似乎與使用Google搜索此主題所能找到的所有建議相違背。

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

+0

我確信我也嘗試過這個選項,但我會回去,並給它一個去並報告回來。至少,它可能會在日誌文件中輸出不同的東西,然後我可以在這裏反饋。 –

+0

你有解決方案的build.proj文件嗎? – IntoNET

+0

我會看看並提供它,如果我這樣做。 –

2

嘗試很多事情後,我發現我使用了錯誤的默認模板。

我所用:

DefaultTemplate.11.1.xaml 

正確的模板對我來說是:

TfvcTemplate.12.xaml 

當我使用這個模板從的NuGet恢復和構建完成正確

+0

我在VS Online的門戶中沒有該模板...您是如何得到它的? –

相關問題