C# Winforms Application to Linux

It is possible to run winforms app in ubuntu?

Re. WinForms: In theory this is possible, though you probably want to check the status of the WinForms project to see how cross-platform this is and whether certain tooling such as the forms designer is available and/or stable. If you were starting from scratch you could use GTK# instead which is cross-platform and has good tooling support in MonoDevelop/Xamarin, but that may not be helpful if you've already invested heavily in WinForms.

Re. compiling for Linux: You shouldn't need to re-compile using Mono unless you are making use of any .NET CLR specific features in your code (which naturally wouldn't be implemented in Mono) or you are using e.g. ILMerge in your build process. I'd throw your exe on Linux with the dependencies and test it to find out. If you do end up needing to recompile you can do this on Linux, BSD or Mac OS X using the Mono compilers directly or open the project in MonoDevelop and build it that way; any of these platforms should produce a program that is executable on any other *nix with Mono.

Importing and developing WinForms applications on linux

You can use Mono. They have a guide here specifically for porting WinForms apps to Mono.

How to port C# applications from windows for linux?

As you have already found out Mono WinForms implementation is suitable only for very simple applications. Take a look at "Cross-Platform Desktop UIs" blog post from Xamarin employee Mike James who summarizes available solutions:

  1. Traditional approach
    WPF or WinForms frontend on Windows, GTK# frontend on Linux and Xamarin.Mac on Mac OS X. IMO this is the best way to go and it may be easier than it looks if you have correctly separated business and presentation layers in your app.
  2. XWT
    XWT toolkit uses the same API and provides native look on all platforms but only a limited subset of components is implemented. Its usability for your projects depends on what components you really need.
  3. HTML frontend
    Create HTML frontend using simple WebView component or Awesomium HTML UI Engine. This may be a viable option in some cases but I am not sure whether it is possible to implement systray icons with this approach.
  4. QTSHARP
    Open source project which aims to implement .NET bindings for multiplatform QT toolkit. I have never tried it but according to project website it seems to be in early stage and currently tested only on Windows.

BTW I am currently using WinForms for Pkcs11Admin application but I plan to use traditional approach as soon as I hit a blocker bug on any of the supported platforms.



Related Topics



Leave a reply



Submit