2

What are the possible ways to convert a windows form application (c# , .net) to a cross platform project?
My GOAL is have a project that can run in both Linux base os and windows.
I really like .net but it's not compatible with all OS (for example Linux) because of .Net Framework installation.

what is your suggestions?

Andres
  • 3,324
  • 6
  • 27
  • 32
SilverLight
  • 19,668
  • 65
  • 192
  • 300
  • 2
    Did you have a look at mono? --> http://www.mono-project.com/ – wonko realtime Mar 18 '14 at 16:17
  • 1
    IronPython is just a .Net implementation of Python. So you dont remove the .Net restriction by moving to IronPython. – crthompson Mar 18 '14 at 16:20
  • Does the project currently (winforms, c#, .net) use python at all? – wonko realtime Mar 18 '14 at 16:21
  • no, i even do n't know IronPython. i just want a cross platfrom convertion way of my project. IronPython is not important for me. – SilverLight Mar 18 '14 at 16:23
  • thanks for the comments - i changed my question - what about mono project? – SilverLight Mar 18 '14 at 16:26
  • Mono is a great choice as long as you don't need WPF (or a few other, smaller areas of .NET). You don't even have to do a conversion, just run the exe with the "mono" command. – BradleyDotNET Mar 18 '14 at 16:27
  • @LordTakkera : can u explain more? i do n't want any terminal using in linux os. just run the application by clicking on it... – SilverLight Mar 18 '14 at 16:30
  • Linux tends to not be very friendly to "just clicking on it" in my experience. I think the closest you could get would be to write a quick bash script that runs the exe and click on that. Some distros may also support "associating" mono with .exe files, but I think that would be distro-specific. – BradleyDotNET Mar 18 '14 at 16:35

1 Answers1

1

As @paqogomez pointed out, IronPython does not take away the need for some sort of .net since, as it's stated on the website http://ironpython.net/ : "IronPython is an excellent addition to the .NET Framework, providing Python developers with the power of the .NET framework."

Since your goal is to run your existing winforms-c#-application on both, windows and linux, you might get away by just using mono (http://www.mono-project.com/).

If this doesn't work out (please refer to http://mono-project.com/Compatibility for compatability issues), you could manually rewrite your existing C# application in pure python. But then, it might well be possible to use any other unmanaged, managed or scripted language which can be used on both systems and which is either easier to translate manually or for which even automated translators exist (however, I don't know if there are any for C#).

Thinking about the last point, I did a quick websearch for "c# cross compiler" which shows some esoteric results which might be interesting for you depending on your project type.

wonko realtime
  • 545
  • 9
  • 26
  • just a question about mono -> should we install it on both win & linux machines to run our exe file? if yes what does cross platform mean about that? – SilverLight Mar 18 '14 at 16:52
  • I admit that I haven't done any big .NET projects targeting multiple platforms, but from the small ones i did i can tell that I always succeeded by compiling the same source code once on windows using visual studio and once on linux using the mono environment, however, there might be plenty of special cases where this doesn't work out well. Also consider having a look at http://stackoverflow.com/questions/751648/whats-the-point-of-mono-on-windows and similar questions which provide a good starting point for a deeper analysis of that. – wonko realtime Mar 18 '14 at 16:59
  • how to use mono? it is so confusing – Sana Ahmed Apr 10 '18 at 13:52