90

I'm trying to deploy my webservice at appharbor using codeplex. 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..

Now I only have 1 error left which I don't know how to solve

   "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

How am I suppose to solve this error ? Any useful links that might help me in the future are also appreciated.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
user1456158
  • 841
  • 1
  • 6
  • 11

6 Answers6

212

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.

Community
  • 1
  • 1
mcdrummerman
  • 2,360
  • 1
  • 15
  • 9
  • 1
    For anyone who can't find it, the nuget.targets file is in the .nuget/ (usually hidden) subfolder of the project folder. – Jeff Hay May 17 '17 at 18:23
  • Thank you man. I have changed NuGet.targets as setting to tag "DownloadNuGetExe" to "true" but didn't restart VS and continue to get the error(s). So after restarting Visual Studio and rebuild solution everything is OK. Again - thanks ;) – Miroslav Hristov Nov 16 '19 at 08:14
  • 1
    This is a workable solution if you want to keep using nuget.targets, but you can also just migrate away from this method of doing package restore and that's generally better. https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore#migrating-to-automatic-restore – Harv Feb 10 '23 at 15:27
101

I resolved the problem by right clicking Solution and click

Enable NuGet Package Restore
BraveNewMath
  • 8,090
  • 5
  • 46
  • 51
14

Executables might be ignored in your .gitignore via

*.exe 

Add this line to .gitignore:

!.nuget/NuGet.exe
Peter Gfader
  • 7,673
  • 8
  • 55
  • 56
3

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.

friism
  • 19,068
  • 5
  • 80
  • 116
3
  • Enable NuGet Package Restore enter image description here
  • Right click on solution then
  • select Enable NuGet Package Restore
Daniel Alder
  • 5,031
  • 2
  • 45
  • 55
0

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.

Lali
  • 2,816
  • 4
  • 30
  • 47