diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs index 707125158a..024b421312 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs @@ -24,6 +24,12 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem "MVC-2.0", new[] { new FallbackRazorExtension("MVC-2.0"), }); + public static readonly RazorConfiguration MVC_2_1 = new FallbackRazorConfiguration( + RazorLanguageVersion.Version_2_1, + "MVC-2.1", + new[] { new FallbackRazorExtension("MVC-2.1"), }); + + public static RazorConfiguration SelectConfiguration(Version version) { if (version.Major == 1 && version.Minor == 0) @@ -38,9 +44,13 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { return MVC_2_0; } + else if (version.Major == 2 && version.Minor == 1) + { + return MVC_2_1; + } else { - return MVC_2_0; + return MVC_2_1; } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs index a2c64907f7..d70f82619e 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs @@ -12,7 +12,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { internal class DefaultProjectEngineFactoryService : RazorProjectEngineFactoryService { - private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_0; + private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_1; private readonly Workspace _workspace; private readonly IFallbackProjectEngineFactory _defaultFactory; @@ -135,9 +135,10 @@ namespace Microsoft.VisualStudio.Editor.Razor // things also. configure = configure ?? ((b) => { }); - // The default configuration currently matches MVC-2.0. Beyond MVC-2.0 we added SDK support for - // properly detecting project versions, so that's a good version to assume when we can't find a - // configuration. + // The default configuration currently matches the newest MVC configuration. + // + // We typically want this because the language adds features over time - we don't want to a bunch of errors + // to show up when a document is first opened, and then go away when the configuration loads, we'd prefer the opposite. var configuration = project?.Configuration ?? DefaultConfiguration; // If there's no factory to handle the configuration then fall back to a very basic configuration.