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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top