.NET Core (简体中文)

From ArchWiki
Revision as of 03:35, 15 July 2019 by Fengchao (talk | contribs) (Add Troubleshooting section.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
翻译状态: 本文是英文页面 .NET Core翻译,最后翻译时间:2019-04-24,点击这里可以查看翻译后英文页面的改动。

.NET Core 是 Microsoft 开发的开源软件框架,支持 C#, Visual Basic 和 F#。和之前的 .NET Framework 相比,它支持跨平台开发,设计上更加模块化,面向现代程序开发。


如果要运行 .NET Core 管理的程序,请安装 dotnet-runtime

要使用 .NET Core 编写程序,还需要安装 dotnet-sdk

微软推荐使用 Visual Studio Code 编译和调试 .NET Core 程序,它是微软开发的基于 Electron 的开源 IDE。


遥测功能默认被打开,可以通过设置环境变量 DOTNET_CLI_TELEMETRY_OPTOUT=1 关闭遥测。


"the required library libhostfxr.so could not be found" error

Some of the dotnet SDK tools (for example libman, dotnet-watch etc.) may expect you to have the environment variable DOTNET_ROOT pre-configured. If it's not, an error like this one could be observed: [1]

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/my_user/.dotnet/tools/.store/microsoft.web.librarymanager.cli/1.0.172/microsoft.web.librarymanager.cli/1.0.172/tools/netcoreapp2.1/any/].
If this is a framework-dependent application, install the runtime in the default location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.

The workaround is to manually export DOTNET_ROOT in your shell:

export DOTNET_ROOT=/opt/dotnet

无法找到指定的 SDK

Mono 和 Dotnet 的 MSBuild SDK 库冲突了,请在 shell 中手动设置路径,将示例中的版本号替换为实际安装的版本:

export MSBuildSDKsPath="/opt/dotnet/sdk/2.2.105/Sdks/";