views:

324

answers:

8

If you were to write an GUI application that runs locally and calls a webservice, to be cross platform, can you do it with .Net, what tools would you recommend?

I was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JVM.

+6  A: 

You should get familiar with the Mono project and MonoDevelop; the express purpose of those projects is to allow building and running .NET code on a variety of platforms, including Windows, Linux, and Mac OSX.

Since the Mono is a re-implementation of .NET, it always lags a little behind Microsoft.NET, but they've got good coverage of .NET 2.0 and some .NET 3.x features. Note that Mono executes .NET binaries, so as long as your program features are supported by Mono, you can take an application EXE you complied on Windows and run it on Linux/Mono without recompiling.

Jon Galloway
Is there any issue with UI development in Mono? Do you have to roll your own?
Dan
Mono has support for Winforms and ASP.NET 2.0 and partial support for 3.x features, so you don't need to roll your own.
Jon Galloway
The only caveat I know of with regard to running .Net code on Mono that was compiled on Windows is the use of PInvoke (calling out to the Win32 API's), which unsurprisingly aren't fully supported by Mono on Linux or Mac. This won't be an issue for your GUI application that calls a webservice :o)
Andrew
Running Mono WinForms is a bad user XP because it does not use native widgets but "draws" Windows-like controls.For real cross-platform GUI with Mono, you can develop a GUI for each platform (WinForms for Windows, Cocoa# for Mac, Gtk#/Qt# for Linux).As the logic is in WS, this should
Vincent Robert
A: 

Check out the Mono project

Also have a look at Silverlight or Flash for rich internet applications.

Ash
A: 

Mono is the only option currently. It runs on these platforms. And there will be problems, not necessarily huge, but still.

Vinko Vrsalovic
Mono isn't the only current option - REALsoftware have a product called REALbasic which can compile the same project to native executables for Windows, Mac and Linux: http://www.realsoftware.com/products/realbasic/
Andrew
Mono actually is the only serious option. REALBasic has nothing to do with .NET framework and this question was about cross platform .NET development.
lubos hasko
Thanks for the correction, lubos :o)
Andrew
+3  A: 

You better write it using some cross-platform toolkit. Most likely you won't be able to use nice visual designer (really this depends on what toolkit you choose), but writing UI by hand is not really that difficult. HTML guys do it all the time and it's quite common practice in non-MS world too.

Some cross-platform UI toolkits with .NET bindings

  • GTK# (de-facto standard for Mono development, MonoDevelop IDE has in-built form designer that is utilizing this toolkit)
  • wxNET (based on wxWindows, quite mature but you will have to built your UI by hand)
  • Qyoto (based on QT, it's probably better than wxWindows but you might need commercial licence from Trolltech if your application can't have open-source license)
lubos hasko
Why not use mono's built-in Winforms? Not using Winforms will make deployment more complicated.
Troels Arvin
because WinForms support is maintained only by Mono devs and as you can see on their website, it's still their second priority. The first one is GTK#. GTK+, wxWindows and QT have far bigger and more dedicated teams than WinForms on Mono so I wouldn't bet on very long lasting WinForms support in Mono
lubos hasko
A: 

As said previously, The Mono Project is your best bet given it's community support.

If you're in Visual Basic then REALbasic could also be worth a look, as it has cross compiler that creates native executables. They have a trial edition you can download too

Andrew
A: 

I recently wrote a little C# GUI application on Linux, compiling and running using mono. I found that I had to use the "gmcs" compiler in order to have access to modern C# and .Net features (mono 1.9 ships with several different compilers).

And when compiling the .exe file, I found that I had to add the "-target:winexe" switch to make the app run on Windows without having a command line pop up behind the application.

I've yet to find out how to compile a .Net application which on Windows will run from network drives without requiring special .Net security configuration on the PC. (I think this is a general issue with .Net applications, but I'm still learning.)

Troels Arvin
+2  A: 

A piece of advise. Cross-platform programming is like cross-browser programming and the one sure thing to do is test, test and test on all platforms you want to support.

chrissie1
A: 

Honestly I would evaluate your customer base and your existing skills. If you've got a 50/50 split, or even a 70/30 split of Windows to non-Windows, you'd likely be better off with Java or some other cross-platform toolkit.

Mono is a decent platform (See this SO question asked about a week ago), but if you are doing anything significant, I'd go with a toolkit designed for it.

BTW, if you want to see what a .NET GUI app looks like on Mono, here's a post I did whenever I got the NUnit GUI running on Mono:

http://www.cornetdesign.com/2006/07/nunit-gui-running-green-on-monolinux.html

Cory Foy