The issue is that by setting compilation options, you’re throwing away all options that come from the project. If you just comment out the line compilation = compilation.WithOptions(options);
, compilation should succeed (at least it does for me for a newly created VB.NET WinForms project).
1
solved Compiler Issue in Visual Basic Project With Microsoft.CodeAnalysis.Emit