Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running the NuGet.exe command

Tags:

nuget

I have basically no idea what is going on here, but I can't run the latest nuget.exe on my machine. The error I get is "Unable to find a version of the runtime to run this application". It doesn't matter if I try to use a specific nuget command or just nuget without parameters.

Any suggestions?

like image 795
Tomas Jansson Avatar asked Apr 20 '11 12:04

Tomas Jansson


People also ask

How do I run NuGet exe?

To use any command, open a command window or bash shell, then run nuget followed by the command and appropriate options, such as nuget help pack (to view help on the pack command). This documentation reflects the latest version of the NuGet CLI.

How do I know if NuGet exe is installed?

How do I check the exact version of the NuGet tools that are installed? In Visual Studio, use the Help > About Microsoft Visual Studio command and look at the version displayed next to NuGet Package Manager.

Where is the NuGet exe located?

Install the official nuget.exe in your PC. Create a Symbolic Link here: %localappdata%\microsoft\winget\links. Make the nuget.exe globally available for your user to call it from anywhere, since the aforementioned directory should be present in your user's PATH variable.


2 Answers

Ok, so this turned out to be a really weird error which I still don't know why it happened. But I do know the solution. What I had done was put the nuget.exe file in c:\windows\system32. I did that so I didn't have to update the %PATH% environment variable, or that was my thought at least. The part about not updating the environment variable worked fine, but for some reason NuGet wouldn't run from that folder for me. When putting the nuget.exe file in a separate folder under c:\Program files (x86) and adding that folder to the %PATH%, it started working just fine.

Weird error.

like image 185
Tomas Jansson Avatar answered Sep 16 '22 22:09

Tomas Jansson


Got exactly the same thing, and solved in exactly the same way.

I have a feeling that the issue is that in someway putting the exe in System32 gives it too many options about which .NET framework to use and so it panics and refuses to use any of them :)

So I'd guess that moving it out of System32 then forces it into using the machine's default, Framework or the first one in PATH or something similar, perhaps?

(Would have put all of this as a comment on Tomas' post, but I can't comment yet :(

like image 42
Brondahl Avatar answered Sep 17 '22 22:09

Brondahl