Skip to content

Commit

Permalink
Don't flow self contained command-line option to referenced projects
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed Nov 18, 2021
1 parent c9eb9dd commit bf752f8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Tasks/Microsoft.Common.CurrentVersion.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
BuildInParallel="$(BuildInParallel)"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
ContinueOnError="!$(BuildingProject)"
RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove);TargetFramework;RuntimeIdentifier$(_GlobalPropertiesToRemoveFromProjectReferences)"
RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove);TargetFramework;RuntimeIdentifier;SelfContained;$(_GlobalPropertiesToRemoveFromProjectReferences)"
Condition="'%(_MSBuildProjectReferenceExistent.SkipGetTargetFrameworkProperties)' != 'true'"
SkipNonexistentTargets="true">
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceTargetFrameworkPossibilities" />
Expand Down Expand Up @@ -1847,6 +1847,14 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<!-- If the project is RID agnostic, undefine the RuntimeIdentifier property to avoid another evaluation. -->
<AnnotatedProjects Condition="'@(AnnotatedProjects)' == '%(Identity)' and '%(AnnotatedProjects.IsRidAgnostic)' == 'true'">
<UndefineProperties>%(AnnotatedProjects.UndefineProperties);RuntimeIdentifier</UndefineProperties>

<!-- Also undefine SelfContained property if it was defined on the command line. Otherwise a command such as
"dotnet build -r win-x64 -/-self-contained" would fail to build referenced projects, as they would have
SelfContained defined but no RuntimeIdentifier.
We only undefine this if the specific command-line option was used, in order to avoid breaking projects
that were passing /p:SelfContained=true on the command-line and relying on it flowing acress projects
(they were then setting the RuntimeIdentifier if SelfContained was true in their props files) -->
<UndefineProperties Condition="'$(_CommandLineDefinedSelfContained)' == 'true'">%(AnnotatedProjects.UndefineProperties);SelfContained</UndefineProperties>
</AnnotatedProjects>

<!--
Expand Down

0 comments on commit bf752f8

Please sign in to comment.