1

We have a few console apps developed with .Net Framework. We used to run them on Windows, but now we'd like to try to use .Net Core for that. So far, this ridiculously simple way works fine (running Framework 4.5.1 app on Core 2.2):

  1. Copy the app with all its dependencies to Linux.

  2. Copy the runtimeconfig.json file from a Hello World .Net Core example to the app dir and rename it accordingly.

  3. Just run dotnet ./app.exe from that dir on Linux.

I find it really surprising that it works without rebuilding for the new target. But I suspect that there may be hidden problems or limitations of this approach. For one thing, obviously it won't run if the app uses something outside Core (say, WPF).

What are the exact conditions for running .Net Framework apps with .Net Core? Anything specific for Linux? Or for specific versions of Framework/Core?

Sergei Tachenov
  • 24,345
  • 8
  • 57
  • 73
  • I think you may take a look at .net framework compatibility mode: https://learn.microsoft.com/en-us/dotnet/core/porting/third-party-deps#net-framework-compatibility-mode – mexanichp May 17 '19 at 04:34
  • @mexanich, it's about porting. My question is about “just copying and running”. – Sergei Tachenov May 17 '19 at 06:01
  • You can use Mono Project to run .NET Framework based application on Linux. https://www.mono-project.com/ "Sponsored by Microsoft, Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime." – Marcio Feb 13 '21 at 13:09

1 Answers1

2

The main things you'll run into is you need to have the dotnet runtime installed on any Linux installation you want to run the application on, else you have to build the binary directly for each of the supported platforms, which at the moment are Ubuntu, Debian, Fedora, Red Hat Enterprise Linux, OpenSUSE, Cent OS and SLES. In general, the only 2 commonly used .NET Framework things that don't work directly are Entity Framework, you need to use Entity Framework Core; and anything UI related. In general, CLI applications should work fine, but may require some tweaking.

Eagerestwolf
  • 378
  • 2
  • 6
  • 2
    It's exactly the “some tweaking” part I'm interested in. Having the runtime installed is not a problem. It's just in-house soft that will run on a few local servers. – Sergei Tachenov May 17 '19 at 05:59