Reputation: 486
I know that .net core is available for Linux, I can build in VS 2019 and publish for Linux, including self-contained package. So that is all beautiful and there would be no issue, unless... We have a customer using RHEL 7.1 little-endian on Power8 CPU where there is Mono 6.8. No dotnet on any PowerPC platform, as far we can see (havent got access to test machine yet). So we need to investigate if the project written in .NET Core 3.1 could be ported to Mono.
As first step to test the porting path, I create simple command line app that basically prints "Hello" and exits. Then I build Any CPU and install Mono 6.12 on Windows, try to run:
> mono Simple.Dll
Hello!
So it worked also with Mono on Windows, and of course with dotnet. Now, build and deploy using RID linux-x64
to the Ubuntu 20.04 running on Windows subsystem for Linux.
Having dotnet installed for Ubuntu, it works fine, both when I use 'Portable' or linux-x64
in deploy:
> dotnet Simple.dll
Hello!
Then I install mono:
> sudo apt install mono-runtime
> ...
> mono --version
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
> dotnet --version
3.1.402
The next obvious step:
> mono Simple.dll
"The entry point method could not be loaded due to Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies."
The same (with Version=4.2.1.0) error happens when I try to downgrade to .NET 2.1. So this is where my understanding of CLI world reaches its limit. Am I missing part of runtime libraries on Ubuntu?
Upvotes: 2
Views: 1481
Reputation: 63295
The dotnet publish
generated binaries are strictly for .NET Core, and only supported on a few platforms,
https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-supported-os.md
If you do need to support more platforms, then
Upvotes: 2