I'm porting some .NET code to mono, which involves #if blocks like:
#if !MONO
// Stuff that only works in >NET
#endif
I can define these things in the csproj file and set a mono build target. However, I was wondering if xbuild or gmcs predefined anything so I know if I'm compiling on mono.
Short answer: no. There's no default flag.
For gmcs, use
gmcs -d:MONO
. If you build using xbuild, you can set the flag in the.csproj
.