I have installed C# extensions, my .NET framework is updated, I just can't fix it.
3 Answers
I have found the fix and I hope this will help someone in the future.
- Find your
.csprojfile. - Change LangVersion property to desired version.
<PropertyGroup>
<LangVersion>7</LangVersion>
</PropertyGroup>
In vs code
Go to the .csproj file and change
<LangVersion>4.0</LangVersion>
to any version you want eg. <LangVersion>7.2</LangVersion>
In Visual Studio
Right-click on the project node in Solution Explorer and select Properties.
Select the Build tab and select the Advanced button.
In language version dropdown, select any version you want.
If you want to change it for only one project, you can edit the project's .csproj file (as other answers here show):
<PropertyGroup>
<LangVersion>7</LangVersion>
</PropertyGroup>
But if you have multiple projects in your solution, and want it changed for all, you need to do the following:
Create a file named: "Directory.Build.props" in the root of the solution.
Add the following to that file:
<Project> <PropertyGroup> <LangVersion>9.0</LangVersion> </PropertyGroup> </Project>
Official documentation is here.


