Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error CS1517 

Error Message

Invalid preprocessor expression

The compiler encountered an invalid preprocessor expression.

For more information, see Preprocessor Directives.

The following sample shows some valid and invalid preprocessor expressions:

// CS1517.cs
#if symbol      // OK
#endif
#if !symbol     // OK
#endif
#if (symbol)    // OK
#endif
#if true        // OK
#endif
#if false       // OK
#endif
#if 1           // CS1517
#endif
#if ~symbol     // CS1517
#endif
#if *           // CS1517
#endif

class x
{
   public static void Main()
   {
   }
}

Community Additions

ADD
Show:
© 2015 Microsoft