2012-04-27 46 views
1

當我嘗試使用Visual Studio 2010提示構建我的mvc3應用程序時。我得到這個錯誤:使用msbuild和nuget恢復包構建mvc3應用程序

"TournamentCompanion.csproj" (default target) (1) -> TournamentCompanion.csproj(553,3): error MSB4019: The imported project "TournamentCompanion(1)\.nuget\nuget.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

,但在.csproj的進口說:

Import Project="$(SolutionDir)\.nuge\nuget.targets"

,這是我的解決方案是什麼樣子:

項目

  • 。 nuget
  • TournamentCompanion | TournamentCompanion.csproj
  • TournamentCompanion.Tests
  • TournamentCompanion.sln

我無法找到一個解決問題的辦法。

回答

1

試試這個,看看你得到同樣的錯誤:

<Import Project="$(MSBuildThisFileDirectory)\..\.nuget\nuget.targets" /> 

它不使用的解決方案相對路徑,結算方式爲你不解決方案文件建立在所有的額外好處如果你想要一個更強大的基礎來構建一個工業強度的命令行版本。

[摘自MSBuild Trickery特技#80]

+0

thx,爲解決方案。我不得不改變NuGet.targets文件。 From: $([System.IO.Path] :: Combine($(SolutionDir),「.nuget」)) 收件人: $([System.IO.Path] :: Combine($(MSBuildThisFileDirectory),「.nuget」)) 然後工作 – hrundal 2012-04-27 14:42:23

+0

我總是將Nuget.config文件放在所有解決方案/項目文件之上的根文件夾中,並將nuget重定向到存儲庫中的單個位置。 <配置> ./軟件包 2012-04-28 16:39:50