Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 456
Nanook Avatar asked Jan 19 '10 10:01

Nanook


1 Answers

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.

like image 187
Oded Avatar answered Oct 12 '22 22:10

Oded