Unable to locate NuGet.exe error | How to Fix This Error

Error: Unable to locate '<path>\.nuget\NuGet.exe'

Here is how you can fix this:
1. Find the .nuget folder in your solution. 
2. Find file nuget.Targets and open the file.
For anyone who can't find it, the nuget.targets file is in the .nuget/ (usually hidden) subfolder of the project folder.
3. Locate a portion of the file that looks like this and set it to true::
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false(etc.)
… and change it to this:
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true(etc.)

4. Also you can ignore Executables (while deploying) in your .gitignore via
*.exe 
Add this line to .gitignore:
!.nuget/NuGet.exe

1 Comments

If you have any questions or concerns, please let me know.

Previous Post Next Post