diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
index b1394c1fbe..b7d17b206b 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
@@ -42,14 +42,6 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
false
-
- false
-
+ $(PreserveCompilationReferences)
+
+
+ true
+
- true
+ true
$(CopyRefAssembliesToPublishDirectory)
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildWithComponentsIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildWithComponentsIntegrationTest.cs
index 678136b0ef..8a5d449cc7 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildWithComponentsIntegrationTest.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildWithComponentsIntegrationTest.cs
@@ -74,6 +74,36 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotExist(result, OutputPath, "ComponentLibrary.Views.pdb");
}
+ [Fact]
+ [InitializeTestProject("ComponentLibrary")]
+ public async Task Build_DoesNotProduceRefsDirectory()
+ {
+ TargetFramework = "netstandard2.0";
+
+ // Build
+ var result = await DotnetMSBuild("Build");
+
+ Assert.BuildPassed(result);
+
+ Assert.FileExists(result, OutputPath, "ComponentLibrary.dll");
+ Assert.FileCountEquals(result, 0, Path.Combine(OutputPath, "refs"), "*.dll");
+ }
+
+ [Fact]
+ [InitializeTestProject("ComponentLibrary")]
+ public async Task Publish_DoesNotProduceRefsDirectory()
+ {
+ TargetFramework = "netstandard2.0";
+
+ // Build
+ var result = await DotnetMSBuild("Publish");
+
+ Assert.BuildPassed(result);
+
+ Assert.FileExists(result, PublishOutputPath, "ComponentLibrary.dll");
+ Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
+ }
+
private async Task Build_ComponentsWorks(MSBuildProcessKind msBuildProcessKind)
{
var result = await DotnetMSBuild("Build", msBuildProcessKind: msBuildProcessKind);
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs
index b33a6b0c71..7befbf9f6c 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs
@@ -144,8 +144,6 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
}
-
-
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task Publish_NoopsWith_RazorCompileOnPublishFalse()