Roslyn throws The language ‘C#’ is not supported

Most likely it’s because you don’t reference Microsoft.CodeAnalysis.CSharp.Workspaces in your code, i.e. you never use a type or method in this dll, so MSBuild thinks it’s not needed (see e.g. this question).

So what you could do is e.g. add the following line somewhere in your class library project:

var _ = typeof(Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions);

Then MSBuild should copy Microsoft.CodeAnalysis.CSharp.Workspaces.dll over and everything should be fine. No need to reference the NuGet packages from all the other projects.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)