I'm using .Net Framework 4.7.2 and am testing setting a solution of 11 projects to use C# 11 syntax.
If I use Directory.Build.props with the following content in an aim to set the entire solution to utilise C# 11 syntax:
<Project>
<PropertyGroup>
<LangVersion>11</LangVersion>
</PropertyGroup>
</Project>
If I then use #error version
in the code behind files.
Upon attempted compilation (which does result in an error) I get two differing results; in VS2022 Pro error tab window I get:
Error CS8304 Compiler version: '4.6.0-3.23329.3 (5db00029)'. Language version: 7.3.
For the same compilation run, if I then look at the VS 2022 Pro output tab window I get:
error CS8304: Compiler version: '4.6.0-3.23329.3 (5db00029)'. Language version: 11.0.
Why does it say C# 7.3? Why the difference? I know that for .Net Framework 4.7.2 the default (if isn't specified) is 4.7.2, but when i have explicitly set the entire solution to use C# 11, why is it reporting C# 7.3 ?
P.S. When it's set to use C# 11 and reports C# 7.3 and C# 11 as described, I can use C# 9 syntax such as target-typed object creation, and it will compile and run without issue... so again, why say C# 7.3 ?