diff --git a/build/common-testapps.props b/build/common-testapps.props index 66df59d175..b584fc30c5 100644 --- a/build/common-testapps.props +++ b/build/common-testapps.props @@ -1,6 +1,5 @@ - - + diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets index 55d6dbace1..6cc82f2db7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -3,7 +3,7 @@ <_MvcRazorOutputPath Condition="'$(MvcRazorOutputPath)'!=''">$([MSBuild]::EnsureTrailingSlash('$(MvcRazorOutputPath)')) <_MvcRazorOutputPath Condition="'$(_MvcRazorOutputPath)'==''">$(IntermediateOutputPath) - <_MvcRazorOutputFullPath>$(_MvcRazorOutputPath)$(MSBuildProjectName).PrecompiledViews.dll + <_MvcRazorOutputFullPath>$(_MvcRazorOutputPath)$(AssemblyName).PrecompiledViews.dll <_MvcRazorResponseFilePath>$(IntermediateOutputPath)microsoft.aspnetcore.mvc.razor.viewcompilation.rsp $(MSBuildProjectDirectory) @@ -21,7 +21,7 @@ + { + public SimpleAppWithAssemblyRenameTest(SimpleAppWithAssemblyRenameTestFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; + + [Theory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor) + { + // Arrange + using (var deployer = Fixture.CreateDeployment(flavor)) + { + var deploymentResult = deployer.Deploy(); + + // Act + var response = await Fixture.HttpClient.GetStringWithRetryAsync( + deploymentResult.ApplicationBaseUri, + Fixture.Logger); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response); + } + } + + public class SimpleAppWithAssemblyRenameTestFixture : ApplicationTestFixture + { + public SimpleAppWithAssemblyRenameTestFixture() + : base("SimpleAppWithAssemblyRename") + { + } + + public override DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) + { + var parameters = base.GetDeploymentParameters(flavor); + parameters.ApplicationName = "NewAssemblyName"; + return parameters; + } + } + } +} diff --git a/testapps/SimpleAppWithAssemblyRename/Controllers/HomeController.cs b/testapps/SimpleAppWithAssemblyRename/Controllers/HomeController.cs new file mode 100644 index 0000000000..ff4fec1f47 --- /dev/null +++ b/testapps/SimpleAppWithAssemblyRename/Controllers/HomeController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace SimpleAppWithAssemblyRename.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/testapps/SimpleAppWithAssemblyRename/Program.cs b/testapps/SimpleAppWithAssemblyRename/Program.cs new file mode 100644 index 0000000000..a8e6434358 --- /dev/null +++ b/testapps/SimpleAppWithAssemblyRename/Program.cs @@ -0,0 +1,26 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace SimpleAppWithAssemblyRename +{ + public class Program + { + public static void Main(string[] args) + { + var config = new ConfigurationBuilder() + .AddCommandLine(args) + .AddEnvironmentVariables(prefix: "ASPNETCORE_") + .Build(); + + var host = new WebHostBuilder() + .UseConfiguration(config) + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj new file mode 100644 index 0000000000..873cd3718e --- /dev/null +++ b/testapps/SimpleAppWithAssemblyRename/SimpleAppWithAssemblyRename.csproj @@ -0,0 +1,21 @@ + + + + NewAssemblyName + netcoreapp1.1;net451 + true + Exe + win7-x64 + true + + + + 1.2.0-* + All + + + + + + + diff --git a/testapps/SimpleAppWithAssemblyRename/Startup.cs b/testapps/SimpleAppWithAssemblyRename/Startup.cs new file mode 100644 index 0000000000..fa29d5b735 --- /dev/null +++ b/testapps/SimpleAppWithAssemblyRename/Startup.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace SimpleAppWithAssemblyRename +{ + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc(); + } + + public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(); + app.UseMvcWithDefaultRoute(); + } + } +} diff --git a/testapps/SimpleAppWithAssemblyRename/Views/Home/Index.cshtml b/testapps/SimpleAppWithAssemblyRename/Views/Home/Index.cshtml new file mode 100644 index 0000000000..9c6b7fb5ff --- /dev/null +++ b/testapps/SimpleAppWithAssemblyRename/Views/Home/Index.cshtml @@ -0,0 +1,5 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +@GetType().AssemblyQualifiedName \ No newline at end of file diff --git a/testapps/SimpleAppWithAssemblyRename/Views/_ViewImports.cshtml b/testapps/SimpleAppWithAssemblyRename/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..f6579ad342 --- /dev/null +++ b/testapps/SimpleAppWithAssemblyRename/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using SimpleAppWithAssemblyRename +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/testapps/TestApps.sln b/testapps/TestApps.sln index c5bd8609a1..895613aa07 100644 --- a/testapps/TestApps.sln +++ b/testapps/TestApps.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26014.0 +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 @@ -23,6 +23,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "StrongNam EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAppDesktopOnly", "SimpleAppDesktopOnly\SimpleAppDesktopOnly.csproj", "{A0B0A141-A32B-4F33-B85F-5CA8C107105F}" 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 @@ -57,6 +59,10 @@ Global {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.Debug|Any CPU.Build.0 = Debug|Any CPU {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.Release|Any CPU.ActiveCfg = Release|Any CPU {A0B0A141-A32B-4F33-B85F-5CA8C107105F}.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