Home

Missing preprocessor symbols for Net Version

I am trying to setup Extensions to exclude items included in newer versions of .Net using conditional compilation, but it seems like the preprocessor symbols for .Net Core versions are not defined in LINQPad?

For example, LINQPad says NET6_0 and NET6_0_OR_GREATER are not defined?

Comments

  • In LINQPad, the symbol is just NET6 - this is equivalent to NET6_0_OR_GREATER

    The default My Extensions query text should contain the following:

    #region Advanced - How to multi-target
    
    // The NET6 symbol is active when the query runs on .NET 6 or later.
    
    #if NET6
    // Code that requires .NET 6 or later
    #endif
    
    #if NET5
    // Code that requires .NET 5 or later
    #endif
    
    #endregion
    
  • Mine just has the NET5 one - it is old :)

Sign In or Register to comment.