views:

91

answers:

3

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?

+4  A: 

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.

Oded
Great tip. I use both of those. Path.Combine only in the past few months though. How do you test for invalid path characters in a multiplatform way?
Nanook
Path.GetInvlidhPathChars - http://msdn.microsoft.com/en-us/library/system.io.path.getinvalidpathchars.aspx
Oded
+1  A: 

Path.Combine springs to mind.

Guidelines:Application_Portability might be usefull

Don
+1  A: 

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.

Coder 42