执行 dotnet aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers
报错:
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/dong/.dotnet/tools/.store/dotnet-aspnet-codegenerator/3.1.1/dotnet-aspnet-codegenerator/3.1.1/tools/netcoreapp3.1/any/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET Core runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=manjaro-x64
解决方案:
编辑: vim ~/.bash_profile
增加 export DOTNET_ROOT=/opt/netcore (.netcore 目录)