2012-04-27 128 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