【问题标题】:dotnet is not recognized as the name of a cmdlet (MacOS)dotnet 未被识别为 cmdlet 的名称 (MacOS)
【发布时间】:2020-05-25 06:31:16
【问题描述】:
这是一件非常奇怪的事情,时不时发生在我身上。在 Mac 上使用 Visual Studio 并且我使用 Nuget 包管理器控制台时,有时它会失去对 dotnet 的访问权限。然后我开始四处寻找并以某种方式再次修复(这可能需要很多时间)。
奇怪的是,dotnet 已安装,从未被移动,我可以在终端中运行它而无需任何位置。因此,它被添加到路径中。
有人遇到过这个问题吗?有什么办法可以解决吗?
【问题讨论】:
标签:
macos
visual-studio
visual-studio-2019
dotnet-cli
nuget-package-manager-console
【解决方案1】:
我有同样的问题。它随机发生。在我找到解决问题的解决方法之前,我浪费了几个小时。
我正在使用:
- NuGet 包管理器控制台 (NuGet 5.6.0.5)
- 在 Visual Studio for Mac COMMUNITY 版本 8.6.1 中
- 并将其用于实体框架命令
示例命令:
PM> Update-Database
Build started...
Build succeeded.
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: 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.
几分钟前意识到,通过清理项目,问题就消失了。
Visual Studio -> Build -> Clean All
然后在 NuGet PM 中再次运行该命令时,它会毫无问题地执行。
PM> Update-Database
Build started...
Build succeeded.
No migrations were applied. The database is already up to date.
Done.
该问题也已发布到开发者社区网页,但很快就关闭了,没有任何解决方案:
https://developercommunity.visualstudio.com/content/problem/913964/dotnet-the-term-dotnet-is-not-recognized-as-the-na.html
我正要重新考虑这个问题。希望他们能提出解决办法。
【解决方案2】:
我的机器上的磁盘空间快用完了。将可用存储空间提高到 5GB 左右。然后重新安装了 NuGet 包管理器控制台。
成功了!