Skip to content

C# LangVersion options only available up to version 6

You can specify the C# language version to use through target_compile_options(${TARGET_NAME} PRIVATE "/langversion:X")

I noticed that only these C# LangVersion property values are currently available: "3, 4, 5, 6, default". Possible values seem to be defined in Templates\MSBuild\FlagTables\v142_CSharp.json

There are apparently quite a few more versions by now: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/language

For my build I need at least version 7. The work around is to either use "default" or to not specify this option at all. target_compile_options(${TARGET_NAME} PRIVATE "/langversion:default")

Both ways will effectively unlock the latest major version number.

That's good enough for me (and probably most people). However, I was modifying an existing CMakeLists.txt which had version set to "6" for by now outdated reasons, and I was wondering why changing it to "7" didn't work. Since I could only figure out the reason by looking at the CMake code, I thought I at least let you know and make this easier for people to find through Google.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information