Nuget packages
Microsoft.Net.Compilersnuget package does not work and needn’t to be installed.
Set the following project/build settings
-
Set at least
C# 7.1or higher in theDebugandReleasebuild properties. (via: Project menu > [ProjectName] Properties > Build tab > [Advanced] button > Language Version). -
Setting it to latest does not work.

Also make sure that you are running the latest MSBuild version.