1

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.

Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
  • [gmcs.exe defines __MonoCS__](http://stackoverflow.com/questions/329043/how-can-i-conditionally-compile-my-c-sharp-for-mono-vs-microsoft-net/329072#329072). This is a duplicate. – Justin Dearing Sep 24 '13 at 19:51

1 Answers1

2

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.

Stephane Delcroix
  • 16,134
  • 5
  • 57
  • 85