Sergei Tachenov
Sergei Tachenov

Reputation: 24919

Run .Net Framework apps with .Net Core (on Linux)

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?

Upvotes: 1

Views: 8708

Answers (1)

Eagerestwolf
Eagerestwolf

Reputation: 388

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.

Upvotes: 2

Related Questions