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?
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 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.
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.
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.
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 :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With