且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows计算机上为Linux编译.NET Core应用程序

更新时间:2022-12-25 16:19:08

使用 dotnet构建命令,您可以指定--runtime标志

Using dotnet build command, you may specify --runtime flag

-r |-运行时< RUNTIME_IDENTIFIER>

-r|--runtime < RUNTIME_IDENTIFIER >

要为其构建目标运行时.有关可以使用的运行时标识符(RID)的列表,请参见 RID目录.

Target runtime to build for. For a list of Runtime Identifiers (RIDs) you can use, see the RID catalog.

代表具体操作系统的

RID通常遵循这种模式[os].[version]-[arch]

RIDs that represent concrete operating systems usually follow this pattern [os].[version]-[arch]

例如,要为Ubuntu 16.04运行时构建项目及其依赖项,请使用

Fo example, to build a project and its dependencies for Ubuntu 16.04 runtime use:

dotnet build --runtime ubuntu.16.04-x64