From 307825b67aa689ce93f6b20dd0f1dbe0e5b4476c Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 17 Oct 2018 15:17:35 -0700 Subject: [PATCH] Set ShouldUnsetParentConfigurationAndPlatform to false in MSBuildWorkspace --- .../Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs | 8 +++++++- .../Core/MSBuild/MSBuild/Constants/PropertyNames.cs | 1 + src/Workspaces/MSBuildTest/NetCoreTests.cs | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs b/src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs index e9203d18b8f..41da37bfe40 100644 --- a/src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs +++ b/src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs @@ -39,7 +39,13 @@ internal class ProjectBuildManager // don't actually run the compiler { PropertyNames.SkipCompilerExecution, bool.TrueString }, - { PropertyNames.ContinueOnError, PropertyValues.ErrorAndContinue } + { PropertyNames.ContinueOnError, PropertyValues.ErrorAndContinue }, + + // this ensures that the parent project's configuration and platform will be used for + // referenced projects. So, setting Configuration=Release will also cause any project + // references to also be built with Configuration=Release. This is necessary for getting + // the correct output path from project references. + { PropertyNames.ShouldUnsetParentConfigurationAndPlatform, bool.FalseString } }.ToImmutableDictionary(); private readonly ImmutableDictionary _additionalGlobalProperties; diff --git a/src/Workspaces/Core/MSBuild/MSBuild/Constants/PropertyNames.cs b/src/Workspaces/Core/MSBuild/MSBuild/Constants/PropertyNames.cs index 0b6a173d8eb..525efe24d69 100644 --- a/src/Workspaces/Core/MSBuild/MSBuild/Constants/PropertyNames.cs +++ b/src/Workspaces/Core/MSBuild/MSBuild/Constants/PropertyNames.cs @@ -49,6 +49,7 @@ internal static class PropertyNames public const string RemoveIntegerChecks = nameof(RemoveIntegerChecks); public const string ResolvedCodeAnalysisRuleSet = nameof(ResolvedCodeAnalysisRuleSet); public const string RootNamespace = nameof(RootNamespace); + public const string ShouldUnsetParentConfigurationAndPlatform = nameof(ShouldUnsetParentConfigurationAndPlatform); public const string SignAssembly = nameof(SignAssembly); public const string SkipCompilerExecution = nameof(SkipCompilerExecution); public const string StartupObject = nameof(StartupObject); diff --git a/src/Workspaces/MSBuildTest/NetCoreTests.cs b/src/Workspaces/MSBuildTest/NetCoreTests.cs index 6c69afad3ef..f58abaeff86 100644 --- a/src/Workspaces/MSBuildTest/NetCoreTests.cs +++ b/src/Workspaces/MSBuildTest/NetCoreTests.cs @@ -369,7 +369,7 @@ public async Task TestOpenSolution_NetCoreMultiTFMWithProjectReferenceToFSharp() [ConditionalFact(typeof(VisualStudioMSBuildInstalled), typeof(DotNetCoreSdk.IsAvailable))] [Trait(Traits.Feature, Traits.Features.MSBuildWorkspace)] [Trait(Traits.Feature, Traits.Features.NetCore)] - public async Task TestOpenSolution_ReferenceConfigurationSpecificMetadata() + public async Task TestOpenProject_ReferenceConfigurationSpecificMetadata() { var files = GetBaseFiles() .WithFile(@"Solution.sln", Resources.SolutionFiles.Issue30174_Solution) -- GitLab