【问题标题】:The term 'dotnet' is not recognized无法识别术语“dotnet”
【发布时间】:2021-01-10 03:14:13
【问题描述】:

非常沮丧,我一直在尝试解决 Visual Studio Code 中的以下错误:

The term 'dotnet' 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:7 + dotnet <<<<  --info
    + CategoryInfo          : ObjectNotFound: (dotnet:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我进行了广泛的研究,但无济于事。我尝试了许多其他人的解决方案,但错误仍然存​​在。我已经多次安装、修复和卸载了必要的安装文件...错误仍然存​​在!

我正在运行带有所有更新的 Win7 Pro。 VS 代码 1.28.2。 NET Core SDK 2.1.403。

我期待任何建议/指针/见解。

【问题讨论】:

  • 显然您正在运行一个 powershell 脚本。你能把它和你的问题一起发布吗?
  • 感谢您的回复。目前,我没有运行 PowerShell 脚本,只是在命令提示符处输入 dotnet --info...

标签: visual-studio .net-core


【解决方案1】:

您的 PATH 环境变量中是否正确设置了 dotnet 二进制文件? 对于 Windows:https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/

【讨论】:

  • 感谢您的意见。我相信我有正确的 PATH 信息。这里是:;C:\Users\Matt\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Matt\.dotnet\tools
  • 我现在没有 Windows,但很确定 dotnet cli 类似于:C:\Program Files\dotnet\sdk\x.x.x\,确认您机器上的路径,然后将其添加到您的 PATH 环境变量,重新启动 VS 代码,应该没问题
【解决方案2】:

同样的事情发生在我身上,我需要做的就是安装 用于 vs 代码的 .NET Core SDK(来自 Microsoft),链接如下:

https://dotnet.microsoft.com/download/dotnet-core/sdk-for-vs-code

【讨论】:

    猜你喜欢
    • 2020-02-14
    • 2020-03-03
    • 1970-01-01
    • 1970-01-01
    • 2022-08-07
    • 2016-11-05
    • 2021-07-02
    • 2017-11-14
    • 1970-01-01
    相关资源
    最近更新 更多