Cross platform .Net? [closed]

霸气de小男生 提交于 2019-12-09 17:56:23

问题


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.


回答1:


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.




回答2:


Another relatively new option for cross-platform .NET development is to use the open source Eto.Forms Framework, which allows you to have one UI codebase target each platform's native toolkit.

For Windows, it uses WinForms or WPF, for Linux, it uses GTK#, and for OS X it uses MonoMac/Cocoa.

There are also mobile ports (iOS/Android) in development.

https://github.com/picoe/Eto




回答3:


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)



回答4:


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.




回答5:


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




回答6:


Check out the Mono project

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




回答7:


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




回答8:


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.)




回答9:


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



来源:https://stackoverflow.com/questions/56013/cross-platform-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!