Reputation: 6526
I can not change the language version in VS 2019, the field is disabled, why? how to enable it?
Upvotes: 8
Views: 8678
Reputation: 81493
You can use the LangVersion
tag in your Project file, C# language versioning
The latest C# compiler determines a default language version based on your project's target framework or frameworks. Visual Studio doesn't provide a UI to change the value, but you can change it by editing the csproj file.
E.g
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>Latest</LangVersion>
...
</PropertyGroup>
Or any found here C# language version reference
However read the notes, only some version are available in certain frameworks. And some are only partially supported
Upvotes: 3