简体   繁体   English

dotnet 未被识别为 cmdlet 的名称 (MacOS)

[英]dotnet is not recognized as the name of a cmdlet (MacOS)

This is a really weird thing that happens to me now and then.这是一件非常奇怪的事情,时不时发生在我身上。 When using visual studio on mac and I use the Nuget Package manager console, sometimes it looses access to dotnet.在 Mac 上使用 Visual Studio 并且我使用 Nuget 包管理器控制台时,有时它无法访问 dotnet。 Then I start pocking around and somehow it fixes again (it can take a lot of time).然后我开始四处寻找并以某种方式再次修复(这可能需要很多时间)。

The weird thing is that dotnet is installed, never was moved and I can run it in Terminal without any location.奇怪的是 dotnet 已安装,从未移动,我可以在没有任何位置的终端中运行它。 So, it is added to the Path.所以,它被添加到路径中。

Has anybody suffered from this problem?有没有人遇到过这个问题? Is there any way to fix that?有没有办法解决这个问题?

I had the same issue.我遇到过同样的问题。 It happens randomly.它是随机发生的。 Lost a couple of hours from my life until I found a workaround that solves the issue.在我找到解决问题的解决方法之前,我失去了几个小时。

I am using:我在用:

  • NuGet Package Manager Console (NuGet 5.6.0.5) NuGet 包管理器控制台 (NuGet 5.6.0.5)
  • in Visual Studio for Mac COMMUNITY Version 8.6.1在 Visual Studio for Mac COMMUNITY 版本 8.6.1
  • and use it for Entity Framework commands并将其用于实体框架命令

Example command:示例命令:

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.

A couple of minutes ago realized that by cleaning the project the issue goes away.几分钟前意识到通过清理项目问题消失了。

Visual Studio -> Build -> Clean All

Then when running again the command in NuGet PM it is executed without any issue.然后在 NuGet PM 中再次运行该命令时,它会毫无问题地执行。

PM>  Update-Database
Build started...
Build succeeded.
No migrations were applied. The database is already up to date.
Done.

The issue was also posted to the developer community web page, but was soon closed without any resolution: https://developercommunity.visualstudio.com/content/problem/913964/dotnet-the-term-dotnet-is-not-recognized-as-the-na.html I am about to reconsider this issue.该问题也发布到了开发者社区网页,但很快被关闭,没有任何解决: https : //developercommunity.visualstudio.com/content/problem/913964/dotnet-the-term-dotnet-is-not-recognized- as-the-na.html我正要重新考虑这个问题。 Hope they will come up with a fix.希望他们能提出解决办法。

The disk space was running out in my machine.我的机器上的磁盘空间已经用完了。 Improving the available storage for around 5GB.将可用存储改进为大约 5GB。 Then reinstalled the NuGet Package Manager Console.然后重新安装 NuGet 包管理器控制台。 It worked!有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM