LangVersion CSharp Not Overridable through Visual Studio Interface
Using the Visual Studio 16 2019
generator CSharp project defaults to <LangVersion>3</LangVersion>
in the generated CSharp project file (i.e. *.csproj). This causes many compatibility issues when using any of the newest features in the language (C# 3.0 dates back to 2008 and the lastest version is 7.2). Using the Visual Studio UI to change the Targeted Language Version does not actually change any of the CMake generated <PropertyGroup>
's it creates a new one:
The Visual Studio manual edit creates this property Group
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<LangVersion>default</LangVersion>
</PropertyGroup>
But this property group (CMake generated) still exists and ignores or overrides the first
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
...
<LangVersion>3</LangVersion>
...
</PropertyGroup>
The easiest way I've found to get past this issue is by removing the tag lines entirely which causes CSharp to go with the latest version. Other option is to update the CMake tag values with a text editor. But preferably would be to update CSharp project generator to create a PropertyGroup for the build configuration that matches what VS2019 expects. In this case, it looks like Label="Configuration"
should just be removed