From 900f38b0c241f8f82de0eb2629ee7052ccbb5858 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 19 Jun 2017 11:24:55 -0700 Subject: [PATCH] Copy precompiled pdb to publish directory Fixes #98 --- .../build/common.targets | 8 ++++++++ test/FunctionalTests/ViewCompilationOptionsTest.cs | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets index 6cc82f2..53f3503 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets +++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/build/common.targets @@ -57,6 +57,10 @@ AfterTargets="ComputeRefAssembliesToPublish" Condition="'$(MvcRazorCompileOnPublish)'=='true'"> + + <_MvcRazorOutputPdbFullPath>$([System.IO.Path]::ChangeExtension('$(_MvcRazorOutputFullPath)', '.pdb')) + + $([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)')) + + + $([System.IO.Path]::GetFileName('$(_MvcRazorOutputPdbFullPath)')) + diff --git a/test/FunctionalTests/ViewCompilationOptionsTest.cs b/test/FunctionalTests/ViewCompilationOptionsTest.cs index 555f630..632aec8 100644 --- a/test/FunctionalTests/ViewCompilationOptionsTest.cs +++ b/test/FunctionalTests/ViewCompilationOptionsTest.cs @@ -52,6 +52,20 @@ public async Task PublishingWithOption_AllowsPublishingRefAssemblies(RuntimeFlav } } + [ConditionalTheory] + [MemberData(nameof(SupportedFlavorsTheoryData))] + public async Task Precompilation_PublishesPdbsToOutputDirectory(RuntimeFlavor flavor) + { + // Arrange + using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + { + var pdbPath = Path.Combine(deployment.DeploymentResult.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); + + // Act & Assert + Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); + } + } + public class TestFixture : ApplicationTestFixture { public TestFixture()