开发者

What are good rules of thumb when writing cross-platform apps in C#?

开发者 https://www.devze.com 2022-12-17 00:34 出处:网络
I haven\'t yet needed to write any cross-platform apps in C#. However, everytime I come to work with paths etc I always wonder what things I should be doing to make my life easier should I need to cro

I haven't yet needed to write any cross-platform apps in C#. However, everytime I come to work with paths etc I always wonder what things I should be doing to make my life easier should I need to cross compile to Mono.

I understand the GUI could be an开发者_如何学编程 issue. I would like to try and employ good cross platform practices in my normal Windows coding if possible.

Are the any ADO issues to watch out for?

What issues have people come across and how are they resolved?


Run everything through MOMA after you have written it. It will identify for you any constructs that are not platform independent or not implemented in the Mono runtime.

Additionaly compile both with MSBuild and the mono .net compiler.

Using Path.Combine and Environment.NewLine are a couple off the top of my head.

Avoid windows only construct (WMI and such) that have no linux/unix analogue.


Path.Combine springs to mind.

Guidelines:Application_Portability might be usefull


If you create your application using Mono in a Windows environment using Gtk# then it should run on all platforms, since it will not use any of the .NET libraries which are not available under Mono, nor will it use any of the Mono/Gtk# libraries which are not supported in Windows.

If you're a Visual Studio user, take a look at the Mono Tools for VS package.

0

精彩评论

暂无评论...
验证码 换一张
取 消