diff --git a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets
index 2aad333593..6dbdf8f49a 100644
--- a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets
+++ b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets
@@ -58,6 +58,16 @@ Copyright (c) .NET Foundation. All rights reserved.
RazorCoreCompile
+
+ $(BuiltProjectOutputGroupDependsOn);
+ _RazorAddBuiltProjectOutputGroupOutput
+
+
+
+ $(DebugSymbolsProjectOutputGroupDependsOn);
+ _RazorAddDebugSymbolsProjectOutputGroupOutput
+
+
_InitializePreserveCompilationContext;
$(PrepareForBuildDependsOn)
@@ -337,16 +347,22 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
-
- $([MSBuild]::EnsureTrailingSlash('$(OutDir)'))
-
-
-
+
+
+
+
+
+
+
+
+
@@ -414,18 +430,14 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
-
- $([MSBuild]::EnsureTrailingSlash('$(OutDir)'))
-
-
+
+
+ $([MSBuild]::EnsureTrailingSlash('$(OutDir)'))
+ $([MSBuild]::Escape($([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::GetFullPath('$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(RazorOutputPath)'))'))))))
+
+ $(RazorTargetDir)$(RazorTargetName).dll
+
+
+
$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Razor\Microsoft.NET.Sdk.Razor.DesignTime.targets
$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.Razor.DesignTime.targets
diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/Assert.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/Assert.cs
index b41e7e4bcc..55791a7284 100644
--- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/Assert.cs
+++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/Assert.cs
@@ -313,7 +313,9 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
}
}
- public static void NupkgContains(MSBuildResult result, string nupkgPath, string filePath)
+ // This method extracts the nupkg to a fixed directory path. To avoid the extra work of
+ // cleaning up after each invocation, this method accepts multiple files.
+ public static void NupkgContains(MSBuildResult result, string nupkgPath, params string[] filePaths)
{
if (result == null)
{
@@ -325,20 +327,23 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
throw new ArgumentNullException(nameof(nupkgPath));
}
- if (filePath == null)
+ if (filePaths == null)
{
- throw new ArgumentNullException(nameof(filePath));
+ throw new ArgumentNullException(nameof(filePaths));
}
nupkgPath = Path.Combine(result.Project.DirectoryPath, nupkgPath);
FileExists(result, nupkgPath);
- var unzipped = Path.Combine(result.Project.DirectoryPath, "nupkg");
+ var unzipped = Path.Combine(result.Project.DirectoryPath, Path.GetFileNameWithoutExtension(nupkgPath));
ZipFile.ExtractToDirectory(nupkgPath, unzipped);
- if (!File.Exists(Path.Combine(unzipped, filePath)))
+ foreach (var filePath in filePaths)
{
- throw new NupkgFileMissingException(result, nupkgPath, filePath);
+ if (!File.Exists(Path.Combine(unzipped, filePath)))
+ {
+ throw new NupkgFileMissingException(result, nupkgPath, filePath);
+ }
}
}
diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/PackIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/PackIntegrationTest.cs
index c040a2ca9b..c6ae4da25a 100644
--- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/PackIntegrationTest.cs
+++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/PackIntegrationTest.cs
@@ -24,9 +24,15 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.NuspecContains(
result,
Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"),
- $"");
+ Assert.NuspecDoesNotContain(
+ result,
+ Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"),
+ $"");
+
Assert.NuspecDoesNotContain(
result,
Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"),
@@ -38,6 +44,33 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Path.Combine("lib", "netstandard2.0", "ClassLibrary.Views.dll"));
}
+ [Fact]
+ [InitializeTestProject("ClassLibrary")]
+ public async Task Pack_WithIncludeSymbols_IncludesRazorPdb()
+ {
+ var result = await DotnetMSBuild("Pack", "/p:RazorCompileOnBuild=true /p:IncludeSymbols=true");
+
+ Assert.BuildPassed(result);
+
+ Assert.NuspecContains(
+ result,
+ Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.symbols.nuspec"),
+ $"");
+
+ Assert.NuspecContains(
+ result,
+ Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.symbols.nuspec"),
+ $"");
+
+ Assert.NupkgContains(
+ result,
+ Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.symbols.nupkg"),
+ Path.Combine("lib", "netstandard2.0", "ClassLibrary.Views.dll"),
+ Path.Combine("lib", "netstandard2.0", "ClassLibrary.Views.pdb"));
+ }
+
[Fact]
[InitializeTestProject("ClassLibrary")]
public async Task Pack_IncludesRazorFilesAsContent_WhenIncludeRazorContentInPack_IsSet()
@@ -53,7 +86,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.NuspecContains(
result,
Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"),
- $"");
Assert.NuspecContains(