diff --git a/RazorViewCompilation.sln b/RazorViewCompilation.sln index 334dab0c09..4386216946 100644 --- a/RazorViewCompilation.sln +++ b/RazorViewCompilation.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26208.0 +VisualStudioVersion = 15.0.26228.4 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}" EndProject @@ -20,9 +20,37 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{87FEE984-F627-4F1E-8995-E5F969B85A19}" ProjectSection(SolutionItems) = preProject + build\common-testapps.props = build\common-testapps.props build\common.props = build\common.props + build\dependencies.props = build\dependencies.props EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleApp", "testapps\SimpleApp\SimpleApp.csproj", "{8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppWithAssemblyRename", "testapps\SimpleAppWithAssemblyRename\SimpleAppWithAssemblyRename.csproj", "{D5677246-BC78-426D-9233-0313A04C6D92}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublishWithEmbedViewSources", "testapps\PublishWithEmbedViewSources\PublishWithEmbedViewSources.csproj", "{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "testapps\StrongNamedApp\StrongNamedApp.csproj", "{87C6A03D-1655-4D1C-82E5-8F553BF4096D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithParseErrors", "testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj", "{AF647059-B86B-46DD-9559-E1324A39B148}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationUsingRelativePaths", "testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj", "{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{559FBB83-40BC-47AF-A224-312CF8E3629B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithCustomInputFiles", "testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj", "{8F73A290-BCE1-461A-9970-397FFBFCC902}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryTagHelper", "testapps\ClassLibraryTagHelper\ClassLibraryTagHelper.csproj", "{196EF313-71CB-47A9-A77D-AACAF62881A1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryWithPrecompiledViews", "testapps\ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj", "{68BB859F-E5D5-407E-9DFB-8CD478EFE90D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationUsingPrecompiledViewClassLibrary", "testapps\ApplicationUsingPrecompiledViewClassLibrary\ApplicationUsingPrecompiledViewClassLibrary.csproj", "{037F4B73-75FB-4570-A38A-9109B580168C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithTagHelpers", "testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj", "{08552602-37E7-48A7-95A2-BB1A1F57C804}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +69,54 @@ Global {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|Any CPU.ActiveCfg = Release|Any CPU {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}.Release|Any CPU.Build.0 = Release|Any CPU + {8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0}.Release|Any CPU.Build.0 = Release|Any CPU + {D5677246-BC78-426D-9233-0313A04C6D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5677246-BC78-426D-9233-0313A04C6D92}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5677246-BC78-426D-9233-0313A04C6D92}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5677246-BC78-426D-9233-0313A04C6D92}.Release|Any CPU.Build.0 = Release|Any CPU + {7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EFC460A-8BAA-4538-8EBE-0B3BB6101E94}.Release|Any CPU.Build.0 = Release|Any CPU + {87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87C6A03D-1655-4D1C-82E5-8F553BF4096D}.Release|Any CPU.Build.0 = Release|Any CPU + {AF647059-B86B-46DD-9559-E1324A39B148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF647059-B86B-46DD-9559-E1324A39B148}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF647059-B86B-46DD-9559-E1324A39B148}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF647059-B86B-46DD-9559-E1324A39B148}.Release|Any CPU.Build.0 = Release|Any CPU + {0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.Build.0 = Release|Any CPU + {559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {559FBB83-40BC-47AF-A224-312CF8E3629B}.Release|Any CPU.Build.0 = Release|Any CPU + {8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F73A290-BCE1-461A-9970-397FFBFCC902}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F73A290-BCE1-461A-9970-397FFBFCC902}.Release|Any CPU.Build.0 = Release|Any CPU + {196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {196EF313-71CB-47A9-A77D-AACAF62881A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {196EF313-71CB-47A9-A77D-AACAF62881A1}.Release|Any CPU.Build.0 = Release|Any CPU + {68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68BB859F-E5D5-407E-9DFB-8CD478EFE90D}.Release|Any CPU.Build.0 = Release|Any CPU + {037F4B73-75FB-4570-A38A-9109B580168C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {037F4B73-75FB-4570-A38A-9109B580168C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {037F4B73-75FB-4570-A38A-9109B580168C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {037F4B73-75FB-4570-A38A-9109B580168C}.Release|Any CPU.Build.0 = Release|Any CPU + {08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08552602-37E7-48A7-95A2-BB1A1F57C804}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08552602-37E7-48A7-95A2-BB1A1F57C804}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -49,5 +125,17 @@ Global {4339FC9B-AEC6-442A-B413-A41555ED76C7} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720} {46C9A4B2-8B1C-451B-B670-C194901D66AC} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} {E0D75B4E-839F-4F80-9B1F-B33F616BCC5F} = {0398AFFF-505E-4283-89DA-BBD9D28B53DB} + {8B7C86DF-FA69-4F3F-A22B-6BFCCBBCEDE0} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {D5677246-BC78-426D-9233-0313A04C6D92} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {7EFC460A-8BAA-4538-8EBE-0B3BB6101E94} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {87C6A03D-1655-4D1C-82E5-8F553BF4096D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {AF647059-B86B-46DD-9559-E1324A39B148} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {0B512D79-AA53-4C97-91B3-B0F8B2CA16B8} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {559FBB83-40BC-47AF-A224-312CF8E3629B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {8F73A290-BCE1-461A-9970-397FFBFCC902} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {196EF313-71CB-47A9-A77D-AACAF62881A1} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {68BB859F-E5D5-407E-9DFB-8CD478EFE90D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {037F4B73-75FB-4570-A38A-9109B580168C} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} + {08552602-37E7-48A7-95A2-BB1A1F57C804} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} EndGlobalSection EndGlobal diff --git a/build/common-testapps.props b/build/common-testapps.props index b584fc30c5..0dc3e2908f 100644 --- a/build/common-testapps.props +++ b/build/common-testapps.props @@ -1,8 +1,22 @@ + + $(MvcRazorCompileOnPublish) + - - + + + + + + + <_MvcViewCompilationBinaryPath>$(MSBuildProjectDirectory)\$(OutputPath)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll + + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets index a64c41b277..a98adaa81c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets @@ -2,6 +2,7 @@ dotnet + <_MvcViewCompilationBinaryPath Condition="'$(_MvcViewCompilationBinaryPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll --runtimeconfig "$(ProjectRuntimeConfigFilePath)" $(ExecArgs) --depsfile "$(ProjectDepsFilePath)" - $(ExecArgs) "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll" + $(ExecArgs) "$(_MvcViewCompilationBinaryPath)" $(ExecArgs) @"$(_MvcRazorResponseFilePath)" diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index 296e1d8843..950417b5d3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -1,13 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.IO; -using System.Linq; using System.Threading.Tasks; -using System.Xml.Linq; -using Microsoft.AspNetCore.Testing.xunit; -using Microsoft.DotNet.Cli.Utils; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation @@ -22,85 +16,26 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public ApplicationTestFixture Fixture { get; } - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux, - SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")] - [OSSkipCondition(OperatingSystems.MacOSX, - SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")] + [Fact] public async Task ConsumingClassLibrariesWithPrecompiledViewsWork() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri + "Manage/Home", - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri + "Manage/Home", + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); } public class ApplicationConsumingPrecompiledViewsFixture : ApplicationTestFixture { - private readonly string _packOutputDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); - public ApplicationConsumingPrecompiledViewsFixture() : base("ApplicationUsingPrecompiledViewClassLibrary") { - ClassLibraryPath = Path.GetFullPath(Path.Combine(ApplicationPath, "..", "ClassLibraryWithPrecompiledViews")); - } - - private string ClassLibraryPath { get; } - - protected override void Restore() - { - CreateClassLibraryPackage(); - var nuGetConfigPath = Path.Combine(ApplicationPaths.SolutionDirectory, "NuGet.config"); - var nugetConfig = XDocument.Parse(File.ReadAllText(nuGetConfigPath)); - var sources = nugetConfig - .Root - .Element("packageSources") - .Elements("add") - .Select(s => s.Attribute("value").Value) - .ToList(); - sources.Add(_packOutputDirectory); - - RestoreProject(ApplicationPath, sources); - } - - private void CreateClassLibraryPackage() - { - RestoreProject(ClassLibraryPath); - ExecuteForClassLibrary(Command.CreateDotNet( - "build", - new[] { "-c", "Release" })); - var packCommand = Command - .CreateDotNet("pack", new[] { "-c", "Release", "-o", _packOutputDirectory }); - - ExecuteForClassLibrary(packCommand); - } - - private void ExecuteForClassLibrary(ICommand command) - { - Console.WriteLine($"Running {command.CommandName} {command.CommandArgs} in {ClassLibraryPath}"); - command - .WorkingDirectory(ClassLibraryPath) - .EnvironmentVariable(NuGetPackagesEnvironmentKey, TempRestoreDirectory) - .EnvironmentVariable(DotnetSkipFirstTimeExperience, "true") - .ForwardStdErr(Console.Error) - .ForwardStdOut(Console.Out) - .Execute() - .EnsureSuccessful(); - } - - public override void Dispose() - { - TryDeleteDirectory(_packOutputDirectory); - base.Dispose(); } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs index ce7a04b015..e44441c917 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation @@ -21,36 +20,30 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public async Task Precompilation_WorksForViewsUsingRelativePath() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response); } [Fact] public async Task Precompilation_WorksForViewsUsingDirectoryTraversal() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response); } public class ApplicationUsingRelativePathsTestFixture : ApplicationTestFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs index d2e25d4538..724a48f44c 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs @@ -20,38 +20,32 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public async Task Precompilation_RunsConfiguredCompilationCallbacks() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); } [Fact] public async Task Precompilation_UsesConfiguredParseOptions() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor", - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor", + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent( - "ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt", - response); - } + // Assert + TestEmbeddedResource.AssertContent( + "ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt", + response); } public class ApplicationWithConfigureMvcFixture : ApplicationTestFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs index c0eac2a314..1df28db3e9 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs @@ -24,20 +24,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests [Fact] public async Task ApplicationWithCustomInputFiles_Works() { + // Arrange var expectedText = "Hello Index!"; - using (var deployer = Fixture.CreateDeployment()) - { - // Arrange - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - Assert.Equal(expectedText, response.Trim()); - } + // Assert + Assert.Equal(expectedText, response.Trim()); } [Fact] @@ -49,21 +46,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests "/Views/Home/About.cshtml", "/Views/Home/Index.cshtml", }; + var deploymentResult = Fixture.CreateDeployment(); - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + // Act + var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", + Fixture.Logger); - // Act - var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", - Fixture.Logger); - - // Assert - var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) - .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); - Assert.Equal(expectedViews, actual); - } + // Assert + var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + Assert.Equal(expectedViews, actual); } [Fact] @@ -80,24 +73,20 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests { "NotIncluded.cshtml", }; + var deploymentResult = Fixture.CreateDeployment(); + var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home"); - using (var deployer = Fixture.CreateDeployment()) + // Act & Assert + foreach (var file in viewsPublished) { - var deploymentResult = deployer.Deploy(); - var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home"); - - // Act & Assert - foreach (var file in viewsPublished) - { - var filePath = Path.Combine(viewsDirectory, file); - Assert.True(File.Exists(filePath), $"{filePath} was not published."); - } + var filePath = Path.Combine(viewsDirectory, file); + Assert.True(File.Exists(filePath), $"{filePath} was not published."); + } - foreach (var file in viewsNotPublished) - { - var filePath = Path.Combine(viewsDirectory, file); - Assert.False(File.Exists(filePath), $"{filePath} was published."); - } + foreach (var file in viewsNotPublished) + { + var filePath = Path.Combine(viewsDirectory, file); + Assert.False(File.Exists(filePath), $"{filePath} was published."); } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs index 28b8b48c8a..2815e42d19 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs @@ -4,14 +4,14 @@ using System; using System.IO; using System.Linq; -using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { - public class ApplicationWithParseErrorsTest : IClassFixture + public class ApplicationWithParseErrorsTest : + IClassFixture { public ApplicationWithParseErrorsTest(ApplicationWithParseErrorsFixture fixture) { @@ -31,18 +31,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation viewImportsPath + " (1): A space or line break was encountered after the \"@\" character. Only valid identifiers, keywords, comments, \"(\" and \"{\" are valid at the start of a code block and they must occur immediately following \"@\" with no space in between.", }; - using (var deployer = Fixture.CreateDeployment()) + + // Act & Assert + Assert.Throws(() => Fixture.CreateDeployment()); + + // Assert + var output = Fixture.TestSink.Writes.Select(w => w.State.ToString().Trim()).ToList(); + + foreach (var error in expectedErrors) { - // Act & Assert - Assert.Throws(() => deployer.Deploy()); - - // Assert - var output = Fixture.TestSink.Writes.Select(w => w.State.ToString().Trim()).ToList(); - - foreach (var error in expectedErrors) - { - Assert.Contains(error, output); - } + Assert.Contains(error, output); } } @@ -55,7 +53,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public TestSink TestSink { get; } = new TestSink(); - protected override ILogger CreateLogger() + public override ILogger CreateLogger() { return new TestLoggerFactory(TestSink, enabled: true).CreateLogger($"{ApplicationName}"); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs index 0579013eb6..0c62583ead 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO; using System.Threading.Tasks; using Xunit; @@ -33,18 +32,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url) { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/{url}", - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/{url}", + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response); } public class ApplicationWithTagHelpersFixture : ApplicationTestFixture @@ -53,12 +49,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation : base("ApplicationWithTagHelpers") { } - - protected override void Restore() - { - RestoreProject(Path.GetFullPath(Path.Combine(ApplicationPath, "..", "ClassLibraryTagHelper"))); - base.Restore(); - } } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs index 91b71be28b..4aec2c3c8b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -5,66 +5,53 @@ using System; using System.Collections.Generic; using System.IO; using System.Net.Http; -using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.DotNet.Cli.Utils; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public abstract class ApplicationTestFixture : IDisposable { - public const string NuGetPackagesEnvironmentKey = "NUGET_PACKAGES"; - public const string DotnetSkipFirstTimeExperience = "DOTNET_SKIP_FIRST_TIME_EXPERIENCE"; public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT"; - - private readonly string _oldRestoreDirectory; - private bool _isRestored; + private readonly object _deploymentLock = new object(); + private IApplicationDeployer _deployer; + private DeploymentResult _deploymentResult; protected ApplicationTestFixture(string applicationName) { ApplicationName = applicationName; - _oldRestoreDirectory = Environment.GetEnvironmentVariable(NuGetPackagesEnvironmentKey); } public string ApplicationName { get; } public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName); - public string TempRestoreDirectory { get; } = CreateTempRestoreDirectory(); - public HttpClient HttpClient { get; } = new HttpClient(); public ILogger Logger { get; private set; } - public IApplicationDeployer CreateDeployment() + public DeploymentResult CreateDeployment() { - PrepareForDeployment(); - var deploymentParameters = GetDeploymentParameters(); - return ApplicationDeployerFactory.Create(deploymentParameters, Logger); - } - - public virtual void PrepareForDeployment() - { - Logger = CreateLogger(); - - if (!_isRestored) + lock (_deploymentLock) { - Restore(); - _isRestored = true; + if (_deployer != null) + { + return _deploymentResult; + } + + Logger = CreateLogger(); + var deploymentParameters = GetDeploymentParameters(); + var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Logger); + _deploymentResult = deployer.Deploy(); + + _deployer = deployer; + + return _deploymentResult; } } public virtual DeploymentParameters GetDeploymentParameters() { - var tempRestoreDirectoryEnvironment = new KeyValuePair( - NuGetPackagesEnvironmentKey, - TempRestoreDirectory); - - var skipFirstTimeCacheCreation = new KeyValuePair( - DotnetSkipFirstTimeExperience, - "true"); - var telemetryOptOut = new KeyValuePair( DotnetCLITelemetryOptOut, "1"); @@ -81,17 +68,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation #else #error the target framework needs to be updated. #endif +#if DEBUG + Configuration = "Debug", +#else Configuration = "Release", +#endif EnvironmentVariables = { - tempRestoreDirectoryEnvironment, - skipFirstTimeCacheCreation, telemetryOptOut, }, PublishEnvironmentVariables = { - tempRestoreDirectoryEnvironment, - skipFirstTimeCacheCreation, telemetryOptOut, }, }; @@ -99,22 +86,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation return deploymentParameters; } - protected virtual ILogger CreateLogger() + public virtual ILogger CreateLogger() { return new LoggerFactory() .AddConsole() .CreateLogger($"{ApplicationName}"); } - protected virtual void Restore() + public void Dispose() { - RestoreProject(ApplicationPath); - } - - public virtual void Dispose() - { - TryDeleteDirectory(TempRestoreDirectory); - HttpClient.Dispose(); + HttpClient?.Dispose(); + _deployer?.Dispose(); } protected static void TryDeleteDirectory(string directory) @@ -128,68 +110,5 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation // Ignore delete failures. } } - - protected void RestoreProject(string applicationDirectory, IList feeds = null) - { - var args = new List - { - "--packages", - TempRestoreDirectory, - }; - - if (feeds != null) - { - foreach (var feed in feeds) - { - args.Add("-s"); - args.Add(feed); - } - } - - var command = Command - .CreateDotNet("restore", args) - .EnvironmentVariable(DotnetSkipFirstTimeExperience, "true") - .CaptureStdErr() - .CaptureStdOut() - .WorkingDirectory(applicationDirectory) - .Execute(); - - if (command.ExitCode != 0) - { - throw new Exception( -$@"dotnet {command.StartInfo.Arguments} failed. -===StdOut=== -{command.StdOut} -===StdErr=== -{command.StdErr}"); - } - } - - private static string CreateTempRestoreDirectory() - { - var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); - return Directory.CreateDirectory(path).FullName; - } - - private static string GetNuGetPackagesDirectory() - { - var nugetFeed = Environment.GetEnvironmentVariable(NuGetPackagesEnvironmentKey); - if (!string.IsNullOrEmpty(nugetFeed)) - { - return nugetFeed; - } - - string basePath; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - basePath = Environment.GetEnvironmentVariable("USERPROFILE"); - } - else - { - basePath = Environment.GetEnvironmentVariable("HOME"); - } - - return Path.Combine(basePath, ".nuget", "packages"); - } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index 0f5f9727a1..fe67e042c4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -32,31 +32,29 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests "/Views/Home/Index.cshtml", }; var expectedText = "Hello Index!"; - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); - var assemblyPath = Path.Combine( - deploymentResult.DeploymentParameters.PublishedApplicationRootPath, - $"{ApplicationName}.PrecompiledViews.dll"); + var deploymentResult = Fixture.CreateDeployment(); - // Act - 1 - var response1 = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/Index", - Fixture.Logger); + var assemblyPath = Path.Combine( + deploymentResult.DeploymentParameters.PublishedApplicationRootPath, + $"{ApplicationName}.PrecompiledViews.dll"); - // Assert - 1 - Assert.Equal(expectedText, response1.Trim()); + // Act - 1 + var response1 = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/Index", + Fixture.Logger); - // Act - 2 - var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", - Fixture.Logger); + // Assert - 1 + Assert.Equal(expectedText, response1.Trim()); - // Assert - 2 - var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) - .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); - Assert.Equal(expectedViews, actual); - } + // Act - 2 + var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( + $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", + Fixture.Logger); + + // Assert - 2 + var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + Assert.Equal(expectedViews, actual); } public class PublishWithEmbedViewSourcesTestFixture : ApplicationTestFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs index a88ecabb9f..6149d37d7a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs @@ -1,10 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation @@ -22,18 +19,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public async Task Precompilation_WorksForSimpleApps() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); } public class SimpleAppTestFixture : ApplicationTestFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs index f0c7bcdfa5..daf2f805c5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs @@ -20,18 +20,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public async Task Precompilation_WorksForSimpleApps() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response); } public class TestFixture : ApplicationTestFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs index 008e8b2279..9f87dd327e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs @@ -19,18 +19,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public async Task PrecompiledAssembliesUseSameStrongNameAsApplication() { // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - var deploymentResult = deployer.Deploy(); + var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, - Fixture.Logger); + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); - // Assert - TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response); - } + // Assert + TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response); } public class StrongNamedAppFixture : ApplicationTestFixture diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs index 15cca9e383..c96eaea4e0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs @@ -20,27 +20,23 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public void Precompilation_PreventsRefAssembliesFromBeingPublished() { - // Arrange - using (var deployer = Fixture.CreateDeployment()) - { - // Act - var deploymentResult = deployer.Deploy(); + // Arrange & Act + var deploymentResult = Fixture.CreateDeployment(); - // Assert - Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs"))); - } + // Assert + Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs"))); } [Fact] public void PublishingWithOption_AllowsPublishingRefAssemblies() { // Arrange - Fixture.PrepareForDeployment(); var deploymentParameters = Fixture.GetDeploymentParameters(); deploymentParameters.PublishEnvironmentVariables.Add( new KeyValuePair("MvcRazorExcludeRefAssembliesFromPublish", "false")); + var logger = Fixture.CreateLogger(); - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.Logger)) + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { // Act var deploymentResult = deployer.Deploy(); diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj index 576633ddd5..4c98058991 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/ApplicationUsingPrecompiledViewClassLibrary.csproj @@ -1,16 +1,23 @@ - - + netcoreapp1.1 Exe - true + - + + + + + + + + + diff --git a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj index c447f7a047..82dbba5e63 100644 --- a/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj +++ b/testapps/ApplicationUsingRelativePaths/ApplicationUsingRelativePaths.csproj @@ -1,16 +1,11 @@ - - + netcoreapp1.1 Exe true - + - - 1.2.0-* - All - diff --git a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj index c447f7a047..82dbba5e63 100644 --- a/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj +++ b/testapps/ApplicationWithConfigureMvc/ApplicationWithConfigureMvc.csproj @@ -1,16 +1,11 @@ - - + netcoreapp1.1 Exe true - + - - 1.2.0-* - All - diff --git a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj index 40565cf420..fac278c0fd 100644 --- a/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj +++ b/testapps/ApplicationWithCustomInputFiles/ApplicationWithCustomInputFiles.csproj @@ -1,5 +1,4 @@  - netcoreapp1.1 Exe @@ -9,11 +8,8 @@ + - - 1.2.0-* - All - diff --git a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj index 0a19352d3a..82dbba5e63 100644 --- a/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj +++ b/testapps/ApplicationWithParseErrors/ApplicationWithParseErrors.csproj @@ -1,15 +1,11 @@  - netcoreapp1.1 Exe true + - - 1.2.0-* - All - diff --git a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj index 9d18cad2e8..f57e4e89ce 100644 --- a/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj +++ b/testapps/ApplicationWithTagHelpers/ApplicationWithTagHelpers.csproj @@ -1,10 +1,10 @@ - - + netcoreapp1.1 Exe true + @@ -12,10 +12,6 @@ - - 1.2.0-* - All - diff --git a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj index 18082d801a..3d49b3a0f1 100644 --- a/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj +++ b/testapps/ClassLibraryTagHelper/ClassLibraryTagHelper.csproj @@ -1,6 +1,5 @@  - netstandard1.6 diff --git a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj index 8847f1713e..49a0b51292 100644 --- a/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj +++ b/testapps/ClassLibraryWithPrecompiledViews/ClassLibraryWithPrecompiledViews.csproj @@ -1,31 +1,16 @@ - - + - 1.0.0-z$([System.DateTime]::UtcNow.Ticks) netcoreapp1.1 Exe obj\precompiled\$(TargetFramework) + true - - - - + - - 1.2.0-* - All - - + diff --git a/testapps/NuGet.config b/testapps/NuGet.config deleted file mode 100644 index af0ad362e1..0000000000 --- a/testapps/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj index 054b6e9527..fa6c75fdd3 100644 --- a/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj +++ b/testapps/PublishWithEmbedViewSources/PublishWithEmbedViewSources.csproj @@ -1,18 +1,13 @@ - - + netcoreapp1.1 Exe true true - + - - 1.2.0-* - All - diff --git a/testapps/SimpleApp/SimpleApp.csproj b/testapps/SimpleApp/SimpleApp.csproj index 0a19352d3a..82dbba5e63 100644 --- a/testapps/SimpleApp/SimpleApp.csproj +++ b/testapps/SimpleApp/SimpleApp.csproj @@ -1,15 +1,11 @@  - netcoreapp1.1 Exe true + - - 1.2.0-* - All - diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj index f34abbf8f5..f0f3a8a7f3 100644 --- a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -1,16 +1,12 @@  - NewAssemblyName netcoreapp1.1 Exe true + - - 1.2.0-* - All - diff --git a/testapps/StrongNamedApp/StrongNamedApp.csproj b/testapps/StrongNamedApp/StrongNamedApp.csproj index 30d5dfeca1..1456d8527d 100644 --- a/testapps/StrongNamedApp/StrongNamedApp.csproj +++ b/testapps/StrongNamedApp/StrongNamedApp.csproj @@ -1,5 +1,4 @@ - - + netcoreapp1.1 Exe @@ -8,12 +7,10 @@ true true + - - 1.2.0-* - diff --git a/testapps/TestApps.sln b/testapps/TestApps.sln deleted file mode 100644 index 67ec53c08d..0000000000 --- a/testapps/TestApps.sln +++ /dev/null @@ -1,64 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26206.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{43488AEE-CCF2-4A90-B890-05320282BE29}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - NuGet.config = NuGet.config - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithTagHelpers", "ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj", "{2079872F-E8F9-4DB1-A340-C0D897807B86}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryTagHelper", "ClassLibraryTagHelper\ClassLibraryTagHelper.csproj", "{39EFA075-3673-49AB-95F3-AA5E88DF6C30}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{E2EAEB85-91D5-478E-9CE2-964F68DE20D0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibraryWithPrecompiledViews", "ClassLibraryWithPrecompiledViews\ClassLibraryWithPrecompiledViews.csproj", "{4684DE8B-3FBE-421B-8798-56C3D6698B76}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublishWIthEmbedViewSources", "PublishWIthEmbedViewSources\PublishWIthEmbedViewSources.csproj", "{E3462190-3068-40F0-9AA5-34779FE252AC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "StrongNamedApp\StrongNamedApp.csproj", "{88903BE5-0676-4667-8160-B24646E0B76E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppWithAssemblyRename", "SimpleAppWithAssemblyRename\SimpleAppWithAssemblyRename.csproj", "{3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2079872F-E8F9-4DB1-A340-C0D897807B86}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2079872F-E8F9-4DB1-A340-C0D897807B86}.Release|Any CPU.Build.0 = Release|Any CPU - {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39EFA075-3673-49AB-95F3-AA5E88DF6C30}.Release|Any CPU.Build.0 = Release|Any CPU - {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2EAEB85-91D5-478E-9CE2-964F68DE20D0}.Release|Any CPU.Build.0 = Release|Any CPU - {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4684DE8B-3FBE-421B-8798-56C3D6698B76}.Release|Any CPU.Build.0 = Release|Any CPU - {E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E3462190-3068-40F0-9AA5-34779FE252AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E3462190-3068-40F0-9AA5-34779FE252AC}.Release|Any CPU.Build.0 = Release|Any CPU - {88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {88903BE5-0676-4667-8160-B24646E0B76E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {88903BE5-0676-4667-8160-B24646E0B76E}.Release|Any CPU.Build.0 = Release|Any CPU - {3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AAF7A48-333C-4D1A-A12B-A3B77DEADF4B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal