#if UNITY ?

I see a number of preprocessor symbols listed at http://unity3d.com/support/documentation/Manual/Platform%20Dependent%20Compilation.html, but I don’t see a catch-all UNITY symbol.

I would like to share some C# source code between Unity and a Visual Studio project, but would prefer there to be a UNITY symbol I can #if against for in Unity/MonoDevelop. Am I not seeing a known symbol, or is there a way to add this symbol to both Unity and MonoDevelop?

just define a symbol like so:

#define UNITY

put that in a script just for unity and drop it in Inspector for Script Execution Order.

Make sure the script element in the inspector goes above the Default Time area using drag n drop.
Then you can check like so in the rest of your scripts:

#if (UNITY)
  ... your code

#if UNITY_5_3_OR_NEWER works best for me. It is defined everywhere from Unity5.3.0 (surprise!)

Here is a list of them.