当尝试向mac上的.net核心应用程序添加身份验证时,请使用以下命令:
dotnet aspnet-codegenerator identity -h我收到这个错误:
Macintosh-2:网站abd$ dotnet代码生成器标识-h发生致命错误,无法找到所需的库libhostfxr.dylib。如果这是一个独立的应用程序,那么这个库应该存在于/Users/abd/.dotnet/tools/.store/dotnet-aspnet-codegenerator/2.2.3/dotnet-aspnet-codegenerator/2.2.3/tools/netcoreapp2.1/any/.中。如果这是一个依赖于框架的应用程序,请将运行时安装在默认位置/usr/local/share/dotnet中,或者使用DOTNET_ROOT环境变量指定运行时位置。我
发布于 2022-01-08 14:34:44
对于Mac M1处理器,.NET库不是位于默认的安装位置"usr/local/share/dotnet"中,而是位于其子目录"./x64"中。
您必须将DOTNET_ROOT环境变量设置为指向该子目录。
export DOTNET_ROOT=/usr/local/share/dotnet/x64
我想这个解决方案可以扩展到M1处理器之外,只要您将DOTNET_ROOT设置为包含libhostfxr.xx的任何目录。
发布于 2020-03-31 11:41:35
Dotnet可执行文件将出现在$DOTNET_ROOT上,您可以在which dotnet或
readlink $(which dotnet)成功的dotnet安装将使libhostfxr.dylib文件位于$DOTNET_ROOT/host/fxr/$version/
如果是这样的话,这是一个权限问题,使用sudo运行就可以了。
sudo dotnet aspnet-codegenerator identity -h发布于 2022-09-29 13:34:28
我在M1 Mac上运行Omnisharp语言服务器时遇到了同样的问题。我的解决方案是将DOTNET_ROOT环境变量设置为正确的全局dotnet位置。对我来说,这是/usr/local/share/dotnet。
我还需要更新/etc/dotnet/install_location的内容。我注意到/etc/dotnet中有两个文件。
install_locationinstall_location_arm64install_location_arm64包含到dotnet (/usr/local/share/dotnet)的正确路径,而install_location包含不存在的/usr/local/share/dotnet/x64。在将install_location的内容更新到/usr/local/share/dotnet之后,问题就解决了。
https://stackoverflow.com/questions/56041783
复制相似问题