0

这是一件非常奇怪的事情,时不时发生在我身上。在 Mac 上使用 Visual Studio 并且我使用 Nuget 包管理器控制台时,有时它会失去对 dotnet 的访问权限。然后我开始四处寻找并以某种方式再次修复(这可能需要很多时间)。

奇怪的是,dotnet 已安装,从未被移动,我可以在终端中运行它而无需任何位置。因此,它被添加到路径中。

有人遇到过这个问题吗?有没有办法解决这个问题?

4

2 回答 2

0

我遇到过同样的问题。它随机发生。在我找到解决问题的解决方法之前,我浪费了几个小时。

我在用:

  • NuGet 包管理器控制台 (NuGet 5.6.0.5)
  • 在 Visual Studio for Mac 社区版本 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 我将重新考虑这个问题。希望他们能提出解决办法。

于 2020-05-31T21:41:50.783 回答
0

我的机器上的磁盘空间快用完了。将可用存储空间提高到 5GB 左右。然后重新安装了 NuGet 包管理器控制台。有效!

于 2020-11-06T15:07:17.387 回答