Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nuget.exe in Visual Studio 2019

I have VS2017 and VS2019 on my machine. I have a lot of nuget references that are missing (yellow icon) in VS2019 Solution Explorer. I've tried doing a Restore Nuget Packages and I see:

All packages are already installed and there is nothing to restore.
Time Elapsed: 00:00:00.0560466
========== Finished ==========

I went into the Package Manager Console and tried to do a:

nuget restore MySolution.sln

and get a

nuget : The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path 
is correct and try again.
At line:1 char:1

I looked around on my hard drive and only see nuget.exe existing in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\SqlChangeAutomation\OctoPack\build\NuGet.exe

Why doesn't it also exist under 2019?

Thanks

like image 978
Eric Avatar asked Feb 03 '20 20:02

Eric


1 Answers

you can download the Nuget.exe from here.

Copy the Nuget.exe somewhere where you keep your tools. Then I recommend entering the location where you saved the Nuget.exe in the PATH system variable.

I would try to clear the nuget cache. You do this with the following command:

nuget locals all -clear

This ensures that all packages are downloaded again.

You cannot call Nuget.exe in the Package Manager Console. To do this, you have to open a console session and change to your solution directory to execute the desired command.

nuget restore MySolution.sln

Above all, it is also very helpful if you browse the Nuget documentation pages a little. You can find them here.

I hope I could help you a little with it and guide you on a possible path.

Best wishes

like image 87
Marcus Avatar answered Nov 13 '22 02:11

Marcus