Should preprocessor symbols should be defined for LINQPad versions?

Options

I think it's great that LINQPad defines preprocessor symbols for .NET versions, similar to what we would have in MSBuild projects, but I'm thinking we'll need them for LINQPad versions as well. Maybe this is a temporary problem?

I have defined in my extensions, new extension properties using the new syntax. I wanted to continue to use LINQPad 8 for "older" projects (I have lots of scripts shelved) and 9 for current stuff. As it turns out, 8 and 9 shares the shelved projects and scripts so that was moot. However now there's a problem, I can't run 8 scripts at all unless I removed the extension properties. I would have to conditionally add the extensions based on the NET10 symbol which fixes the problem there. However now I cannot use the extensions in 9 unless I explicitly target .NET 10. 9 supports experimental compiler stuff so I'd expect it to work with .NET 9 and it does... but it's not supported in LINQPad 8.

I think we need symbols for the LINQPad versions.

Answers

  • Something like _MSC_VER?

    _MSC_VER Defined as an integer literal that encodes the major and minor number elements of the compiler's version number. The major number is the first element of the period-delimited version number and the minor number is the second element. For example, if the version number of the Microsoft C/C++ compiler is 17.00.51106.1, the value of _MSC_VER is 1700. Enter cl /? at the command line to view the compiler's version number. This macro is always defined.

  • Yes, more or less. LINQPad already defines symbols for the major .NET versions and that worked for a while since LINQPad versions lined up with the releases. Though, the .NET 10 preview features only works with LINQPad 9.

  • Presumably you need LINQPad 8 for .NET 3.1 / 5.0 support?

    I'll add a LINQPAD9 symbol to the next build.