【发布时间】:2019-04-13 01:44:09
【问题描述】:
我面临的情况是 Windows Server 2012 中的 Powershell 无法识别 nuget.exe。我很确定环境变量已正确设置。但是我收到以下错误:
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
+ nuget
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (nuget:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
即使我转到存在nuget.exe 的目录并执行nuget,我也会遇到同样的错误。
Windows CMD 显示nuget is not a recognized command,但如果我在存在nuget.exe 的目录中执行nuget,它工作正常。
我在为 nuget 设置环境变量时犯了错误吗?请帮忙:)
注意:我是 dotnet 技术生态系统的新手。
【问题讨论】:
-
在 PowerShell 中,如果您导航到可执行文件的文件夹,则必须在名称前加上“.\”才能运行它。例如:
C:\Nuget> .\nuget.exe -
@boxdog 成功了。感谢您帮助我和其他陷入这种情况的人:)
标签: c# .net powershell nuget windows-server-2012