From 4eb4cef18c94bbec0455889c252e3cda75b5d284 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 15 Jul 2019 14:48:01 -0700 Subject: [PATCH] Limit PreserveCompilationReferences to netcoreapp (<2.x)and net4x projects \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/b9c695c2d50c229ea3c2aa583af969992531d428 --- .../Sdk.Razor.CurrentVersion.props | 8 ----- .../Sdk.Razor.CurrentVersion.targets | 16 +++++++--- .../BuildWithComponentsIntegrationTest.cs | 30 +++++++++++++++++++ .../PublishIntegrationTest.cs | 2 -- 4 files changed, 42 insertions(+), 14 deletions(-) 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()