Cross compile dotnet core from Windows to Linux


#1

I am working on Windows and want to run the .exe I have compiled, on Linux. I see there is .DLL file references in the published folder, which would obviously not work on Linux - how do I compile the .exe 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?


#2

If you’re writing a portable application (which is the default), then you run dotnet publish on Windows, copy the publish directory over to Linux and then run dotnet yourapplication.dll on Linux.

If you’re writing a self-contained application, then you need to define RID for the version of Linux you’re using (e.g. ubuntu.16.04-x64) in the "runtimes" section of your project.json. Then you also run dotnet publish on Windows, copy the publish directory for your Linux version to the Linux machine and run ./yourapplication on Linux.


#3

More details on Self Contained Deployment (SCD) and Framework-Dependent Deployment (FDD) could be found with examples at https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/


#4

I am trying to build the Dotnet core for a Ubuntu 16.04 ARM 32 bit machine. The CLI and CoreFX will not build because some of the “bootstrap” utilities like the dotnet command executable are not present for this platform. So, I thought I might be able to build everything on an Intel Windows 10 platform and publish it for the ARM 32 bit Ubuntu platform. However, this does not work because the moniker for ubuntu.16.04-x32 does not exist. So I edited the several hundred files in the CLI project to add the necessary information for ubuntu.16.04-x32, but it will still not build because it cannot find the necessary native utilities from Microsoft.

Is there anyway of accomplishing this for ARM 32 with out the bootstrap tools from Microsoft?

Is there anyway of building the dotnet command line utility either native on ARM, or cross compiling on Windows?

Thanks,
Gene


.NET Foundation Website | Blog | Projects | Code of Conduct