This project is read-only.

Can only build C# 5.0

Topics: APIs, General
Jun 21, 2014 at 12:38 AM
Whenever I try to emit a project I load in any way, I get diagnostic errors if it uses C# 6.0 preview features enabled by Roslyn. They compile fine in VS, but I'm not finding a way to build them using the Emit feature of the Roslyn API.
Is there a way to build these projects with Roslyn?
Jun 21, 2014 at 6:17 PM
The issue seems to be that the emit behavior changed in the second release.

The SDK samples compile C# 6.0 code fine, but if I update the 0.6x Roslyn references to the 0.7x ones, they will only emit C# 5.0 as well. Is this change intentional? Anyone knows a workaround?
Jun 21, 2014 at 6:28 PM
Jun 21, 2014 at 7:22 PM
Edited Jun 21, 2014 at 7:24 PM
The issue is that the newer version seems to treat LanguageVersion.CSharp6 as LanguageVersion.CSharp5. One workaround is to specify a parse option with the language version set to LanguageVersion.Experimental.
public static partial class RoslynExtension {
    public static Project WithExperimentalParseOptions(this Project project) {
                return project.WithParseOptions(project.ParseOptions.ToExperimental());
    public static CSharpParseOptions ToExperimental(this ParseOptions options) {
        return new CSharpParseOptions(
The Project returned by WithExperimentalParseOptions will not raise diagnostic errors for currently implemented C# 6.0 features.
Jul 24, 2014 at 6:13 PM
This is ByDesign.
Features that may undergo design changes, possibly based on the customer feedback, light up only under "experimental".
Once the design is considered solid enough, they will be moved to C#6.0
Marked as answer by VSadov on 7/24/2014 at 10:13 AM