运行 NuGet.exe 命令时出错
我基本上不知道这里发生了什么,但我无法在我的机器上运行最新的 nuget.exe 。我收到的错误是“无法找到运行此应用程序的运行时版本”。我是否尝试使用特定的 nuget 命令或仅使用不带参数的 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,事实证明这是一个非常奇怪的错误,我仍然不知道为什么会发生。但我确实知道解决方案。我所做的是将
nuget.exe
文件放入c:\windows\system32
中。我这样做是为了不必更新%PATH%
环境变量,或者至少这是我的想法。关于不更新环境变量的部分工作正常,但由于某种原因,NuGet 无法从该文件夹运行。将nuget.exe
文件放入c:\Program files (x86)
下的单独文件夹中并将该文件夹添加到%PATH%
时,它开始工作得很好。奇怪的错误。
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 inc:\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 thenuget.exe
file in a separate folder underc:\Program files (x86)
and adding that folder to the%PATH%
, it started working just fine.Weird error.
得到完全相同的事情,并以完全相同的方式解决。
我有一种感觉,问题在于,以某种方式将 exe 放入 System32 中,给了它太多关于要使用哪个 .NET 框架的选项,因此它会出现恐慌并拒绝使用其中任何一个:)
所以我猜想将其移出System32 的然后强制它使用机器的默认框架或 PATH 中的第一个框架或类似的东西,也许?
(本可以将所有这些作为对托马斯帖子的评论,但我还不能发表评论:(
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 :(