From 14e606997f8ef409f0ead89c0eda972bd09f96ab Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Fri, 4 Jan 2019 14:45:18 -0800 Subject: [PATCH] Fix #5116 Remove support for 2.0 precompilation Obsoletes RazorViewAttribute and RazorPageAttribute and removes all of our usage of them. I've already made the changes to have the SDK stop generating these. --- src/AuthSamples/build/dependencies.props | 2 +- src/Mvc/Mvc.sln | 17 +- .../Compilation/CompiledViewDescriptor.cs | 26 ++- .../Compilation/RazorViewAttribute.cs | 1 + .../CompiledPageRouteModelProvider.cs | 9 - .../Infrastructure/RazorPageAttribute.cs | 1 + .../RazorBuildTest.cs | 26 +-- .../RazorCompiledItemFeatureProviderTest.cs | 12 +- .../DefaultRazorPageFactoryProviderTest.cs | 5 +- .../Compilation/RazorViewCompilerTest.cs | 1 - .../CompiledPageRouteModelProviderTest.cs | 202 ++++++------------ .../Infrastructure/DefaultPageLoaderTest.cs | 3 +- .../TestRazorCompiledItem.cs | 22 +- .../Pages/Precompilation/Page.cs | 39 ---- .../Pages/Precompilation/Page_Model.cs | 9 - .../Views/Common/CommonView.cs | 37 ---- .../Views/Precompilation/View.cs | 37 ---- .../RazorBuildWebSite.Views/Pages/Rzc/Page.cs | 1 - .../Views/Common/CommonView.cs | 1 - .../RazorBuildWebSite.Views/Views/Rzc/View.cs | 1 - .../Pages/Precompilation/Page.cshtml | 4 - .../RazorBuildWebSite.csproj | 3 +- .../Views/Precompilation/View.cshtml | 1 - 23 files changed, 124 insertions(+), 336 deletions(-) delete mode 100644 src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page.cs delete mode 100644 src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page_Model.cs delete mode 100644 src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Common/CommonView.cs delete mode 100644 src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Precompilation/View.cs delete mode 100644 src/Mvc/test/WebSites/RazorBuildWebSite/Pages/Precompilation/Page.cshtml delete mode 100644 src/Mvc/test/WebSites/RazorBuildWebSite/Views/Precompilation/View.cshtml diff --git a/src/AuthSamples/build/dependencies.props b/src/AuthSamples/build/dependencies.props index ac3ece8537..87bd618059 100644 --- a/src/AuthSamples/build/dependencies.props +++ b/src/AuthSamples/build/dependencies.props @@ -57,7 +57,7 @@ 3.19.8 5.3.0 3.0.0-preview1-26907-05 - 3.0.0-preview-18579-0056 + 3.0.0-preview.19053.2 15.6.1 3.0.1 3.0.0-alpha1-10772 diff --git a/src/Mvc/Mvc.sln b/src/Mvc/Mvc.sln index d0cb0d402c..1dfdb97911 100644 --- a/src/Mvc/Mvc.sln +++ b/src/Mvc/Mvc.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28414.68 -MinimumVisualStudioVersion = 15.0.26730.03 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{32285FA4-6B46-4D6B-A840-2B13E4C8B58E}" @@ -148,8 +148,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorBuildWebSite", "test\WebSites\RazorBuildWebSite\RazorBuildWebSite.csproj", "{BF8A3392-C3D2-4813-855A-E906564600E1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorBuildWebSite.PrecompiledViews", "test\WebSites\RazorBuildWebSite.PrecompiledViews\RazorBuildWebSite.PrecompiledViews.csproj", "{856D7E25-E033-477D-9ABD-0B50CF428C80}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorBuildWebSite.Views", "test\WebSites\RazorBuildWebSite.Views\RazorBuildWebSite.Views.csproj", "{8916DDCA-EC2A-4193-B9F3-78CAA1A96D5A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Analyzers", "src\Microsoft.AspNetCore.Mvc.Analyzers\Microsoft.AspNetCore.Mvc.Analyzers.csproj", "{87A3E227-C45E-4141-A59F-402908E651FD}" @@ -868,18 +866,6 @@ Global {BF8A3392-C3D2-4813-855A-E906564600E1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {BF8A3392-C3D2-4813-855A-E906564600E1}.Release|x86.ActiveCfg = Release|Any CPU {BF8A3392-C3D2-4813-855A-E906564600E1}.Release|x86.Build.0 = Release|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Debug|Any CPU.Build.0 = Debug|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Debug|x86.ActiveCfg = Debug|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Debug|x86.Build.0 = Debug|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Release|Any CPU.ActiveCfg = Release|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Release|Any CPU.Build.0 = Release|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Release|x86.ActiveCfg = Release|Any CPU - {856D7E25-E033-477D-9ABD-0B50CF428C80}.Release|x86.Build.0 = Release|Any CPU {8916DDCA-EC2A-4193-B9F3-78CAA1A96D5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8916DDCA-EC2A-4193-B9F3-78CAA1A96D5A}.Debug|Any CPU.Build.0 = Debug|Any CPU {8916DDCA-EC2A-4193-B9F3-78CAA1A96D5A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -1634,7 +1620,6 @@ Global {F16CEE0D-A28E-43BD-802F-99BAFE4BA7CE} = {FDC66952-A3EA-4074-899E-C29816BF7C1F} {7500B228-1769-4CFB-A571-3DFAC6678A06} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {BF8A3392-C3D2-4813-855A-E906564600E1} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {856D7E25-E033-477D-9ABD-0B50CF428C80} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {8916DDCA-EC2A-4193-B9F3-78CAA1A96D5A} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {87A3E227-C45E-4141-A59F-402908E651FD} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {E3E09D2F-1FCF-4396-9B09-5A62CA8CC831} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs index 213218c5cd..6d0213ea30 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewDescriptor.cs @@ -21,6 +21,23 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation } + /// + /// Creates a new . + /// + /// The . + public CompiledViewDescriptor(RazorCompiledItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + + Item = item; + ExpirationTokens = Array.Empty(); + RelativePath = ViewPath.NormalizePath(item.Identifier); + } + +#pragma warning disable CS0618// Type or member is obsolete /// /// Creates a new . At least one of or /// must be non-null. @@ -28,6 +45,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation /// The . /// The . public CompiledViewDescriptor(RazorCompiledItem item, RazorViewAttribute attribute) +#pragma warning restore CS0618 // Type or member is obsolete { if (item == null && attribute == null) { @@ -44,7 +62,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation // // In theory we could look at the 'Item.Kind' to determine what kind of thing we're dealing // with, but for compat reasons we're basing it on ViewAttribute since that's what 2.0 had. +#pragma warning disable CS0618 // Type or member is obsolete ViewAttribute = attribute; +#pragma warning restore CS0618 // Type or member is obsolete // We don't have access to the file provider here so we can't check if the files // even exist or what their checksums are. For now leave this empty, it will be updated @@ -58,13 +78,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation /// public string RelativePath { get; set; } +#pragma warning disable CS0618 + // Type or member is obsolete /// /// Gets or sets the decorating the view. /// /// /// May be null. /// + [Obsolete("Use Item instead. RazorViewAttribute has been superseded by RazorCompiledItem and will not be used by the runtime.")] public RazorViewAttribute ViewAttribute { get; set; } +#pragma warning restore CS0618 // Type or member is obsolete /// /// instances that indicate when this result has expired. @@ -79,6 +103,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation /// /// Gets the type of the compiled item. /// - public Type Type => Item?.Type ?? ViewAttribute?.ViewType; + public Type Type => Item?.Type; } } \ No newline at end of file diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewAttribute.cs index 1ac6aba09a..233edc6aa1 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewAttribute.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorViewAttribute.cs @@ -5,6 +5,7 @@ using System; namespace Microsoft.AspNetCore.Mvc.Razor.Compilation { + [Obsolete("This attribute has been superseded by RazorCompiledItem and will not be used by the runtime.")] [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public class RazorViewAttribute : Attribute { diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs index 54b67eb1db..855fcb6d1a 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/CompiledPageRouteModelProvider.cs @@ -82,10 +82,6 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels { return viewDescriptor.Item.Kind == RazorPageDocumentKind; } - else if (viewDescriptor.ViewAttribute != null) - { - return viewDescriptor.ViewAttribute is RazorPageAttribute; - } return false; } @@ -133,11 +129,6 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels internal static string GetRouteTemplate(CompiledViewDescriptor viewDescriptor) { - if (viewDescriptor.ViewAttribute != null) - { - return ((RazorPageAttribute)viewDescriptor.ViewAttribute).RouteTemplate; - } - if (viewDescriptor.Item != null) { return viewDescriptor.Item.Metadata diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/RazorPageAttribute.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/RazorPageAttribute.cs index 900827a018..2fe3030064 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/RazorPageAttribute.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/RazorPageAttribute.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Compilation; namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure { + [Obsolete("This attribute has been superseded by RazorCompiledItem and will not be used by the runtime.")] public class RazorPageAttribute : RazorViewAttribute { public RazorPageAttribute(string path, Type viewType, string routeTemplate) diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorBuildTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorBuildTest.cs index 08097d5224..e90c761c83 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorBuildTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.FunctionalTests/RazorBuildTest.cs @@ -17,30 +17,6 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests public HttpClient Client { get; } - [Fact] - public async Task PrecompiledPage_LocalPageWithDifferentContent_NotUsed() - { - // Act - var response = await Client.GetAsync("http://localhost/Precompilation/Page"); - var responseBody = await response.Content.ReadAsStringAsync(); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("Hello from buildtime-compiled precompilation page!", responseBody.Trim()); - } - - [Fact] - public async Task PrecompiledView_LocalViewWithDifferentContent_NotUsed() - { - // Act - var response = await Client.GetAsync("http://localhost/Precompilation/View"); - var responseBody = await response.Content.ReadAsStringAsync(); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("Hello from buildtime-compiled precompilation view!", responseBody.Trim()); - } - [Fact(Skip = "https://github.com/aspnet/Mvc/issues/8753")] public async Task Rzc_LocalPageWithDifferentContent_IsUsed() { @@ -66,7 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests } [Fact] - public async Task RzcViewsArePreferredToPrecompiledViews() + public async Task RzcViewsArePreferredToRuntimeViews() { // Verifies that when two views have the same paths, the one compiled using rzc is preferred to the one from Precompilation. // Act diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs index ffcc6ad8cf..de3b31d0b3 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs @@ -41,16 +41,18 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts var item1 = Mock.Of(i => i.Identifier == "Item1" && i.Type == typeof(TestView)); var item2 = Mock.Of(i => i.Identifier == "Item2" && i.Type == typeof(TestPage)); - var attribute1 = new RazorViewAttribute("Item1", typeof(TestView)); - var attribute2 = new RazorViewAttribute("Item2", typeof(TestPage)); - - var assembly = new TestAssembly(new[] { attribute1, attribute2 }); + var assembly = new TestAssembly(new[] + { + new RazorCompiledItemAttribute(typeof(TestView), "mvc.1.0.razor-page", "Item1"), + new RazorCompiledItemAttribute(typeof(TestView), "mvc.1.0.razor-view", "Item1"), + }); var part1 = new AssemblyPart(assembly); var part2 = new Mock(); part2 .As() - .Setup(p => p.CompiledItems).Returns(new[] { item1, item2, }); + .Setup(p => p.CompiledItems) + .Returns(new[] { item1, item2, }); var featureProvider = new RazorCompiledItemFeatureProvider(); var feature = new ViewsFeature(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/DefaultRazorPageFactoryProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/DefaultRazorPageFactoryProviderTest.cs index 4e35a4f838..c1b0b0c0d8 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/DefaultRazorPageFactoryProviderTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/DefaultRazorPageFactoryProviderTest.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Hosting; using Microsoft.Extensions.Primitives; using Moq; using Xunit; @@ -54,7 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation var descriptor = new CompiledViewDescriptor { RelativePath = relativePath, - ViewAttribute = new RazorViewAttribute(relativePath, typeof(TestRazorPage)), + Item = TestRazorCompiledItem.CreateForView(typeof(TestRazorPage), relativePath), ExpirationTokens = expirationTokens, }; var compilerCache = new Mock(); @@ -80,7 +81,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation var descriptor = new CompiledViewDescriptor { RelativePath = relativePath, - ViewAttribute = new RazorViewAttribute(relativePath, typeof(TestRazorPage)), + Item = TestRazorCompiledItem.CreateForView(typeof(TestRazorPage), relativePath), ExpirationTokens = Array.Empty(), }; var viewCompiler = new Mock(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/RazorViewCompilerTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/RazorViewCompilerTest.cs index ac26f8e66e..790efd95dd 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/RazorViewCompilerTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/RazorViewCompilerTest.cs @@ -23,7 +23,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation var result2 = await viewCompiler.CompileAsync(path); // Assert - Assert.Null(result1.ViewAttribute); Assert.Empty(result1.ExpirationTokens); } diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/ApplicationModels/CompiledPageRouteModelProviderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/ApplicationModels/CompiledPageRouteModelProviderTest.cs index c462f8edb5..c0cf96f38c 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/ApplicationModels/CompiledPageRouteModelProviderTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/ApplicationModels/CompiledPageRouteModelProviderTest.cs @@ -22,67 +22,16 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_AddsModelsForCompiledViews() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_0_Descriptor("/Pages/About.cshtml"), - CreateVersion_2_0_Descriptor("/Pages/Home.cshtml", "some-prefix"), - }; - - var provider = CreateProvider(descriptors: descriptors); - var context = new PageRouteModelProviderContext(); - - // Act - provider.OnProvidersExecuting(context); - - // Assert - Assert.Collection( - context.RouteModels, - result => - { - Assert.Equal("/Pages/About.cshtml", result.RelativePath); - Assert.Equal("/About", result.ViewEnginePath); - Assert.Collection( - result.Selectors, - selector => Assert.Equal("About", selector.AttributeRouteModel.Template)); - Assert.Collection( - result.RouteValues.OrderBy(k => k.Key), - kvp => - { - Assert.Equal("page", kvp.Key); - Assert.Equal("/About", kvp.Value); - }); - }, - result => - { - Assert.Equal("/Pages/Home.cshtml", result.RelativePath); - Assert.Equal("/Home", result.ViewEnginePath); - Assert.Collection( - result.Selectors, - selector => Assert.Equal("Home/some-prefix", selector.AttributeRouteModel.Template)); - Assert.Collection( - result.RouteValues.OrderBy(k => k.Key), - kvp => - { - Assert.Equal("page", kvp.Key); - Assert.Equal("/Home", kvp.Value); - }); - }); - } - - [Fact] // 2.1 adds some additional metadata to the view descriptors. We want to make sure both versions work. - public void OnProvidersExecuting_AddsModelsForCompiledViews_Version_2_1() - { - // Arrange - var descriptors = new[] - { - CreateVersion_2_1_Descriptor("/Pages/About.cshtml"), - CreateVersion_2_1_Descriptor("/Pages/Home.cshtml", metadata: new[] + TestRazorCompiledItem.CreateForPage("/Pages/About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/Home.cshtml", metadata: new[] { new RazorCompiledItemMetadataAttribute("RouteTemplate", "some-prefix"), }), }; - var provider = CreateProvider(descriptors: descriptors); + var provider = CreateProvider(items); var context = new PageRouteModelProviderContext(); // Act @@ -127,12 +76,15 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_AddsModelsForCompiledAreaPages() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_0_Descriptor("/Areas/Products/Files/About.cshtml"), - CreateVersion_2_0_Descriptor("/Areas/Products/Pages/About.cshtml"), - CreateVersion_2_0_Descriptor("/Areas/Products/Pages/Manage/Index.cshtml"), - CreateVersion_2_0_Descriptor("/Areas/Products/Pages/Manage/Edit.cshtml", "{id}"), + TestRazorCompiledItem.CreateForPage("/Areas/Products/Files/About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Areas/Products/Pages/About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Areas/Products/Pages/Manage/Index.cshtml"), + TestRazorCompiledItem.CreateForPage("/Areas/Products/Pages/Manage/Edit.cshtml", metadata: new object[] + { + new RazorCompiledItemMetadataAttribute("RouteTemplate", "{id}"), + }), }; var options = new RazorPagesOptions @@ -141,7 +93,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels RootDirectory = "/Files", }; - var provider = CreateProvider(options: options, descriptors: descriptors); + var provider = CreateProvider(items, options); var context = new PageRouteModelProviderContext(); // Act @@ -216,12 +168,12 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_DoesNotAddAreaAndNonAreaRoutesForAPage() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_0_Descriptor("/Areas/Accounts/Pages/Manage/Home.cshtml"), - CreateVersion_2_0_Descriptor("/Areas/Accounts/Manage/Home.cshtml"), - CreateVersion_2_0_Descriptor("/Areas/About.cshtml"), - CreateVersion_2_0_Descriptor("/Contact.cshtml"), + TestRazorCompiledItem.CreateForPage("/Areas/Accounts/Pages/Manage/Home.cshtml"), + TestRazorCompiledItem.CreateForPage("/Areas/Accounts/Manage/Home.cshtml"), + TestRazorCompiledItem.CreateForPage("/Areas/About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Contact.cshtml"), }; var options = new RazorPagesOptions @@ -229,7 +181,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels RootDirectory = "/", }; - var provider = CreateProvider(options: options, descriptors: descriptors); + var provider = CreateProvider(items, options); var context = new PageRouteModelProviderContext(); // Act @@ -279,14 +231,17 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_AddsMultipleSelectorsForIndexPage_WithIndexAtRoot() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_0_Descriptor("/Pages/Index.cshtml"), - CreateVersion_2_0_Descriptor("/Pages/Admin/Index.cshtml", "some-template"), + TestRazorCompiledItem.CreateForPage("/Pages/Index.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/Admin/Index.cshtml", metadata: new object[] + { + new RazorCompiledItemMetadataAttribute("RouteTemplate", "some-template"), + }), }; var options = new RazorPagesOptions { RootDirectory = "/" }; - var provider = CreateProvider(options: options, descriptors: descriptors); + var provider = CreateProvider(items, options); var context = new PageRouteModelProviderContext(); // Act @@ -319,13 +274,16 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_AddsMultipleSelectorsForIndexPage() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_0_Descriptor("/Pages/Index.cshtml"), - CreateVersion_2_0_Descriptor("/Pages/Admin/Index.cshtml", "some-template"), + TestRazorCompiledItem.CreateForPage("/Pages/Index.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/Admin/Index.cshtml", metadata: new object[] + { + new RazorCompiledItemMetadataAttribute("RouteTemplate", "some-template"), + }), }; - var provider = CreateProvider(descriptors: descriptors); + var provider = CreateProvider(items); var context = new PageRouteModelProviderContext(); // Act @@ -358,13 +316,19 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_AllowsRouteTemplatesWithOverridePattern() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_0_Descriptor("/Pages/Index.cshtml", "~/some-other-prefix"), - CreateVersion_2_0_Descriptor("/Pages/Home.cshtml", "/some-prefix"), + TestRazorCompiledItem.CreateForPage("/Pages/Index.cshtml", metadata: new object[] + { + new RazorCompiledItemMetadataAttribute("RouteTemplate", "~/some-other-prefix"), + }), + TestRazorCompiledItem.CreateForPage("/Pages/Home.cshtml", metadata: new object[] + { + new RazorCompiledItemMetadataAttribute("RouteTemplate", "/some-prefix"), + }), }; - var provider = CreateProvider(descriptors: descriptors); + var provider = CreateProvider(items); var context = new PageRouteModelProviderContext(); // Act @@ -399,16 +363,16 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels // to a Razor Page added by a library. // Arrange - var descriptors = new[] + var items = new[] { // Page coming from the app - CreateVersion_2_1_Descriptor("/Pages/About.cshtml"), - CreateVersion_2_1_Descriptor("/Pages/Home.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/Home.cshtml"), // Page coming from the app - CreateVersion_2_1_Descriptor("/Pages/About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/About.cshtml"), }; - var provider = CreateProvider(descriptors: descriptors); + var provider = CreateProvider(items); var context = new PageRouteModelProviderContext(); // Act @@ -433,13 +397,13 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void OnProvidersExecuting_AllowsRazorFilesWithUnderscorePrefix() { // Arrange - var descriptors = new[] + var items = new[] { - CreateVersion_2_1_Descriptor("/Pages/_About.cshtml"), - CreateVersion_2_1_Descriptor("/Pages/Home.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/_About.cshtml"), + TestRazorCompiledItem.CreateForPage("/Pages/Home.cshtml"), }; - var provider = CreateProvider(descriptors: descriptors); + var provider = CreateProvider(items); var context = new PageRouteModelProviderContext(); // Act @@ -480,42 +444,15 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels }); } - [Fact] - public void GetRouteTemplate_ReturnsPathFromRazorPageAttribute() - { - // Arrange - var expected = "test"; - var descriptor = CreateVersion_2_0_Descriptor("/Pages/Home.cshtml", expected); - - // Act - var result = CompiledPageRouteModelProvider.GetRouteTemplate(descriptor); - - // Assert - Assert.Equal(expected, result); - } - - [Fact] - public void GetRouteTemplate_ReturnsNull_IfPageAttributeDoesNotHaveTemplate() - { - // Arrange - var descriptor = CreateVersion_2_0_Descriptor("/Pages/Home.cshtml", routeTemplate: null); - - // Act - var result = CompiledPageRouteModelProvider.GetRouteTemplate(descriptor); - - // Assert - Assert.Null(result); - } - [Fact] public void GetRouteTemplate_ReturnsPathFromMetadataAttribute() { // Arrange var expected = "test"; - var descriptor = CreateVersion_2_1_Descriptor("/Pages/About.cshtml", metadata: new object[] + var descriptor = new CompiledViewDescriptor(TestRazorCompiledItem.CreateForPage("/Pages/About.cshtml", metadata: new object[] { new RazorCompiledItemMetadataAttribute("RouteTemplate", expected), - }); + })); // Act var result = CompiledPageRouteModelProvider.GetRouteTemplate(descriptor); @@ -528,7 +465,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels public void GetRouteTemplate_ReturnsNull_IfAttributeDoesNotExist() { // Arrange - var descriptor = CreateVersion_2_1_Descriptor("/Pages/About.cshtml"); + var descriptor = new CompiledViewDescriptor(TestRazorCompiledItem.CreateForPage("/Pages/About.cshtml")); // Act var result = CompiledPageRouteModelProvider.GetRouteTemplate(descriptor); @@ -537,9 +474,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels Assert.Null(result); } - private TestCompiledPageRouteModelProvider CreateProvider( - RazorPagesOptions options = null, - IList descriptors = null) + private CompiledPageRouteModelProvider CreateProvider(IList items, RazorPagesOptions options = null) { options = options ?? new RazorPagesOptions(); @@ -548,31 +483,14 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels Options.Create(options), NullLogger.Instance); - provider.Descriptors.AddRange(descriptors ?? Array.Empty()); + for (var i = 0; i < items.Count; i++) + { + provider.Descriptors.Add(new CompiledViewDescriptor(items[i])); + } return provider; } - private static CompiledViewDescriptor CreateVersion_2_0_Descriptor(string path, string routeTemplate = "") - { - return new CompiledViewDescriptor - { - RelativePath = path, - ViewAttribute = new RazorPageAttribute(path, typeof(object), routeTemplate), - }; - } - - private static CompiledViewDescriptor CreateVersion_2_1_Descriptor( - string path, - object[] metadata = null) - { - return new CompiledViewDescriptor - { - RelativePath = path, - Item = new TestRazorCompiledItem(typeof(object), "mvc.1.0.razor-page", path, metadata ?? Array.Empty()), - }; - } - private class TestCompiledPageRouteModelProvider : CompiledPageRouteModelProvider { public TestCompiledPageRouteModelProvider( diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageLoaderTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageLoaderTest.cs index 0000ce40b1..ecbb41a8a7 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageLoaderTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageLoaderTest.cs @@ -5,6 +5,7 @@ using System; using System.Reflection; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.Razor.Compilation; +using Microsoft.AspNetCore.Razor.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Moq; @@ -493,7 +494,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure { var descriptor = new CompiledViewDescriptor { - ViewAttribute = new RazorPageAttribute("/Views/Index.cshtml", typeof(object), null), + Item = TestRazorCompiledItem.CreateForView(typeof(object), "/Views/Index.cshtml"), }; var compiler = new Mock(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorCompiledItem.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorCompiledItem.cs index 6bd6b246e9..aed8172d3e 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorCompiledItem.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Views.TestCommon/TestRazorCompiledItem.cs @@ -10,12 +10,32 @@ namespace Microsoft.AspNetCore.Razor.Hosting { public class TestRazorCompiledItem : RazorCompiledItem { + public static RazorCompiledItem CreateForPage(string identifier, object[] metadata = null) + { + return CreateForPage(type: null, identifier, metadata); + } + + public static RazorCompiledItem CreateForPage(Type type, string identifier, object[] metadata = null) + { + return new TestRazorCompiledItem(type, "mvc.1.0.razor-page", identifier, metadata); + } + + public static RazorCompiledItem CreateForView(string identifier, object[] metadata = null) + { + return CreateForView(type: null, identifier, metadata); + } + + public static RazorCompiledItem CreateForView(Type type, string identifier, object[] metadata = null) + { + return new TestRazorCompiledItem(type, "mvc.1.0.razor-page", identifier, metadata); + } + public TestRazorCompiledItem(Type type, string kind, string identifier, object[] metadata) { Type = type; Kind = kind; Identifier = identifier; - Metadata = metadata; + Metadata = metadata ?? Array.Empty(); } public override string Identifier { get; } diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page.cs deleted file mode 100644 index 989480bc6d..0000000000 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page.cs +++ /dev/null @@ -1,39 +0,0 @@ -#pragma checksum "D:\k\Mvc\test\WebSites\RazorBuildWebSite\Pages\Precompilation\Page.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f3a9fa49018f90b3470f6c0e4f475d1d8c9cd456" -// -#pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/Pages/Precompilation/Page.cshtml", typeof(RazorBuildWebSite.Pages.Precompilation._Pages_Precompilation_Page), null)] -namespace RazorBuildWebSite.Pages.Precompilation -{ -#line hidden - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Microsoft.AspNetCore.Mvc; - using Microsoft.AspNetCore.Mvc.Rendering; - using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class _Pages_Precompilation_Page : global::Microsoft.AspNetCore.Mvc.RazorPages.Page - { -#pragma warning disable 1998 - public async override global::System.Threading.Tasks.Task ExecuteAsync() - { - BeginContext(26, 52, true); - WriteLiteral("\r\nHello from buildtime-compiled precompilation page!\r\n"); - EndContext(); - } -#pragma warning restore 1998 - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; - public Page_Model Model => ViewData.Model; - } -} -#pragma warning restore 1591 diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page_Model.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page_Model.cs deleted file mode 100644 index bc6db7744e..0000000000 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Pages/Precompilation/Page_Model.cs +++ /dev/null @@ -1,9 +0,0 @@ - -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace RazorBuildWebSite.Pages.Precompilation -{ - public class Page_Model : PageModel - { - } -} diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Common/CommonView.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Common/CommonView.cs deleted file mode 100644 index 429418e2d5..0000000000 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Common/CommonView.cs +++ /dev/null @@ -1,37 +0,0 @@ -#pragma checksum "D:\k\Mvc\test\WebSites\RazorBuildWebSite\Views\Common\CommonView.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a09a0106df2e63aecf6fc6ddf30df39b489d9783" -// -#pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/Common/CommonView.cshtml", typeof(RazorBuildWebSite.Views.Precompilation._Views_Precompilation_CommonView))] -namespace RazorBuildWebSite.Views.Precompilation -{ -#line hidden - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Microsoft.AspNetCore.Mvc; - using Microsoft.AspNetCore.Mvc.Rendering; - using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class _Views_Precompilation_CommonView : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - { -#pragma warning disable 1998 - public async override global::System.Threading.Tasks.Task ExecuteAsync() - { - BeginContext(0, 48, true); - WriteLiteral("Hello from buildtime-compiled precompilation view!"); - EndContext(); - } -#pragma warning restore 1998 - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } - } -} -#pragma warning restore 1591 diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Precompilation/View.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Precompilation/View.cs deleted file mode 100644 index 704f7fbeee..0000000000 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.PrecompiledViews/Views/Precompilation/View.cs +++ /dev/null @@ -1,37 +0,0 @@ -#pragma checksum "D:\k\Mvc\test\WebSites\RazorBuildWebSite\Views\Precompilation\View.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a09a0106df2e63aecf6fc6ddf30df39b489d9783" -// -#pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/Precompilation/View.cshtml", typeof(RazorBuildWebSite.Views.Precompilation._Views_Precompilation_View))] -namespace RazorBuildWebSite.Views.Precompilation -{ -#line hidden - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Microsoft.AspNetCore.Mvc; - using Microsoft.AspNetCore.Mvc.Rendering; - using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class _Views_Precompilation_View : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - { -#pragma warning disable 1998 - public async override global::System.Threading.Tasks.Task ExecuteAsync() - { - BeginContext(0, 48, true); - WriteLiteral("Hello from buildtime-compiled precompilation view!"); - EndContext(); - } -#pragma warning restore 1998 - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } - [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] - public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper Html { get; private set; } - } -} -#pragma warning restore 1591 diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Pages/Rzc/Page.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Pages/Rzc/Page.cs index 57149440b2..fdf6b93690 100644 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Pages/Rzc/Page.cs +++ b/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Pages/Rzc/Page.cs @@ -2,7 +2,6 @@ // #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(RazorBuildWebSite.Pages.Rzc.Pages_Rzc_Page), @"mvc.1.0.razor-page", @"/Pages/Rzc/Page.cshtml")] -[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/Pages/Rzc/Page.cshtml", typeof(RazorBuildWebSite.Pages.Rzc.Pages_Rzc_Page), null)] namespace RazorBuildWebSite.Pages.Rzc { #line hidden diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Common/CommonView.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Common/CommonView.cs index c94a379958..48889a559d 100644 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Common/CommonView.cs +++ b/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Common/CommonView.cs @@ -2,7 +2,6 @@ // #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(RazorBuildWebSite.Views.Rzc.Views_Rzc_View), @"mvc.1.0.view", @"/Views/Common/CommonView.cshtml")] -[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/CommonView.cshtml", typeof(RazorBuildWebSite.Views.Rzc.Views_Rzc_View))] namespace RazorBuildWebSite.Views.Rzc { #line hidden diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Rzc/View.cs b/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Rzc/View.cs index 4b731211e5..f56ff8f74e 100644 --- a/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Rzc/View.cs +++ b/src/Mvc/test/WebSites/RazorBuildWebSite.Views/Views/Rzc/View.cs @@ -2,7 +2,6 @@ // #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(RazorBuildWebSite.Views.Rzc.Views_Rzc_View), @"mvc.1.0.view", @"/Views/Rzc/View.cshtml")] -[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/Rzc/View.cshtml", typeof(RazorBuildWebSite.Views.Rzc.Views_Rzc_View))] namespace RazorBuildWebSite.Views.Rzc { #line hidden diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite/Pages/Precompilation/Page.cshtml b/src/Mvc/test/WebSites/RazorBuildWebSite/Pages/Precompilation/Page.cshtml deleted file mode 100644 index 7a399ab8a0..0000000000 --- a/src/Mvc/test/WebSites/RazorBuildWebSite/Pages/Precompilation/Page.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@page -@model Page_Model - -Hello from runtime-compiled precompilation page! diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj b/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj index 6bdd331814..f7fcee6d8a 100644 --- a/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj +++ b/src/Mvc/test/WebSites/RazorBuildWebSite/RazorBuildWebSite.csproj @@ -11,8 +11,7 @@ - - + diff --git a/src/Mvc/test/WebSites/RazorBuildWebSite/Views/Precompilation/View.cshtml b/src/Mvc/test/WebSites/RazorBuildWebSite/Views/Precompilation/View.cshtml deleted file mode 100644 index 92afcc7180..0000000000 --- a/src/Mvc/test/WebSites/RazorBuildWebSite/Views/Precompilation/View.cshtml +++ /dev/null @@ -1 +0,0 @@ -Hello from runtime-compiled precompilation view! \ No newline at end of file