在 appharbor 上构建 webservice 时无法定位 nuget.exe

我正在尝试使用 cotiles 在 appharbor 部署我的 webservice。 After trying it the first time and doing some research I found out that I had to use NuGet so the references are being found..

现在我只剩下一个错误,我不知道如何解决

   "D:\temp\g3wyilvx.uln\input\WebService\Webservice.sln" (default target) (1) ->
"D:\temp\g3wyilvx.uln\input\WebService\Webservice\Webservice.csproj" (default target) (2) ->
(CheckPrerequisites target) ->
D:\temp\g3wyilvx.uln\input\WebService\.nuget\nuget.targets(72,9): error : Unable to locate 'D:\temp\g3wyilvx.uln\input\WebService\.nuget\nuget.exe' [D:\temp\g3wyilvx.uln\input\WebService\Webservice\Webservice.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.17

我该如何解决这个错误? 任何有用的链接,可能有助于我在未来也感谢。

49660 次浏览

Here's a blogpost on using NuGet package restore with AppHarbor. In your case, the problem might be that you haven't included the .nuget folder in your repository.

Executables might be ignored in your .gitignore via

*.exe

Add this line to .gitignore:

!.nuget/NuGet.exe

I resolved the problem by right clicking Solution and click

Enable NuGet Package Restore

I solved this by changing this line in my NuGet.targets file and setting it to true:

<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>

But you must restart Visual Studio or reload the solution (see this) for this to take effect.

  • Enable NuGet Package Restore enter image description here
  • Right click on solution then
  • select Enable NuGet Package Restore

I faced this issue, when one of my colleague added a new project in solution. He added new packages from nuget. The above top rated answer was not acceptable for me because once I update nuget packages, it updates all referenced libraries in the project.

How I removed this error, by just removing import statements for nuget package from .csproj files.

To do so, right click on .csproj file, and open it in notepad and remove the statement.