9

I am working in Windows and want to build a dotnet core app on Windows to run on Linux. In the build folder, I see .DLL file references in the published folder, which would obviously not work on Linux - how do I compile the app from my Windows environment to run on Linux? Is it possible?

In the project.json file there is runtime versions specified, which I believe correlates to the runtimes in the C:\Program Files\dotnet\sdk\1.0.0-preview2-003121\runtimes location? If so, how do I get the Linux runtime installed in Windows and reference it?

Johan Foley
  • 338
  • 4
  • 9
  • 2
    You can read about it over here https://learn.microsoft.com/en-us/dotnet/articles/core/tutorials/using-with-xplat-cli – Kiran Aug 04 '16 at 18:00

1 Answers1

7

You can create self contained applications using publish command.

For example (.Net Core 2.0):

dotnet publish -c release -r win7-x64
dotnet publish -c release -r centos.7-x64

You need to specify win7-x64 OR centos.7-x64 in RuntimeIdentifiers also in the .csproj file.

For more help check this page.

perror
  • 7,071
  • 16
  • 58
  • 85
Harit Kumar
  • 2,272
  • 2
  • 12
  • 24