[Mono-list] Making code conditional on "not running on mono"?
Thu, 15 May 2003 22:46:32 +0100
If you are happy to have two seperate binaries and a common source code you
could use the C# preprocessor. Surround the windows specific code with
and then define WINDOWS inside visual studio as one of the defines to pass
to the compiler. This is what I am doing with an ASP.NET project I'm porting
across to mono, and so far it is working quite well.
[mailto:firstname.lastname@example.org]On Behalf Of Stuart Ballard
Sent: 14 May 2003 15:23
Subject: [Mono-list] Making code conditional on "not running on mono"?
I have a C# program which uses some classes (specifically
System.DirectoryServices) that aren't implemented in Mono. The code in
question is not critical to the application and the majority of the
functionality would work fine if it wasn't there. I can't remove the
code entirely (because in some cases we actually do need the
functionality) but I can't compile on Mono with it present, because the
classes aren't found.
Is there any way I can avoid having to have two different copies of the
source code, one for Mono without the feature and one for MS.NET with
the feature included?
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
Mono-list maillist - Monoemail@example.com