I am trying to target .NET 4.6 and also take advantage of the latest C# version by changing the C# language version to 6.
However during compilation I got this error
I had similar issue when I was loading application for the first time in visual studio 2019. Updating "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" nuget to later version did the trick for me.