[Mono-list] Making code conditional on "not running on mono"?
Theo Spears
mono@terrarium.f9.co.uk
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
#if WINDOWS
#endif
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.
Theo Spears
-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com]On Behalf Of Stuart Ballard
Sent: 14 May 2003 15:23
To: mono-list@lists.ximian.com
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?
Thanks,
Stuart.
--
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
www.fast.net
_______________________________________________
Mono-list maillist - Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list