-1

I have Windows version of .NET Framework desktop application. Now I want to make version available for MacOS as well.

Is there any solution available using C#?

Will .NET Core work for both Windows and MacOs?

Mobeen
  • 45
  • 1
  • 8
  • 2
    The official documentation is your friend: https://learn.microsoft.com/en-us/dotnet/core/install/macos. And no, you cannot run .NET Framework apps on MacOS. – Camilo Terevinto Oct 10 '20 at 09:45
  • According to [this post](https://stackoverflow.com/questions/31864724/can-you-install-and-run-apps-built-on-the-net-framework-on-a-mac#:~:text=NET%20Core%20will%20install%20and,Visual%20Studio%20for%20Mac), you can run .Net Core apps on both Windows and MacOs. You can follow the instruction [here](https://stackify.com/cross-platform-net-core-apps/#:~:text=NET%20Core%20is%20that%20you,architectures%20like%20x86%20and%20ARM.). – Lê Kiệt Oct 10 '20 at 09:32
  • @LêKiệt The question is about **.NET Framework** and not about **dotnet core** – Markus Meyer Oct 10 '20 at 09:47
  • 1
    @MarkusMeyer The question clearly states "Will .Net Core work for both Windows and MacOs?", so this question is not about .NET Framework but about what would work in MacOS. – Camilo Terevinto Oct 10 '20 at 09:52
  • 2
    .NET Core per se - yes, it will run on MacOS. WPF or Windows Forms - even on .NET Core - however will **not** .. See here: https://devblogs.microsoft.com/dotnet/net-core-3-and-support-for-windows-desktop-applications/ – marc_s Oct 10 '20 at 09:53
  • 1
    Do you mean it is a desktop application on Windows (eg. WinForms/WPF)? If so, it will not run on Linux/MacOS on top of .NET Core. If it is a WinForms app, the .NET Framework build _might_ run on Linux/MacOS using [Mono](https://www.mono-project.com/docs/gui/winforms/) but only if it does not use any Windows API directly. – György Kőszeg Oct 10 '20 at 10:18
  • @GyörgyKőszeg I have already build application using WinForms C#. I have created exe for window.. Similarly I want to run application on MacOS as well – Mobeen Oct 10 '20 at 10:40

1 Answers1

0

I have already build application using WinForms C#. I have created exe for window.. Similarly I want to run application on MacOS as well

You can try Mono then. It has (a rather limited) WinForms support. But if you never tested it on any other platforms yet, then be prepared for some issues. Among others:

  • You will not able to use any WinAPI directly (ie. extern methods to Win32 dlls)
  • You might expect some behavioral differences. Some of them affect only particular distributions.
  • Many of these can be handled by special handlings in you code, though. But it means you will need some IsWindowsdistinction here and there, just like in this project of mine.

And do not forget to install libgdiplus, which makes possible to use System.Drawing on non-Windows platforms, as WinForms is built on GDI+.

György Kőszeg
  • 17,093
  • 6
  • 37
  • 65