How to compile .NET Core app for Linux on a Windows machine

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

-r|–runtime < RUNTIME_IDENTIFIER >

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

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

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

dotnet build --runtime ubuntu.16.04-x64

Leave a Comment