Skip to content

Commit d9f4a44

Browse files
committed
Adjust the implementation to use new MSBuild Common targets trcking features
1 parent e3e7323 commit d9f4a44

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DefaultOutputPaths.targets

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ Copyright (c) .NET Foundation. All rights reserved.
5151
<ArtifactsBinOutputName Condition="'$(ArtifactsBinOutputName)' == ''">bin</ArtifactsBinOutputName>
5252
<ArtifactsPublishOutputName Condition="'$(ArtifactsPublishOutputName)' == ''">publish</ArtifactsPublishOutputName>
5353
<ArtifactsPackageOutputName Condition="'$(ArtifactsPackageOutputName)' == ''">package</ArtifactsPackageOutputName>
54-
<!-- When using artifacts output, we need to track file writes with a bit more knowledge than the MSBuild Common targets have-->
55-
<IncrementalCleanDependsOn>$(IncrementalCleanDependsOn);_TrackFileWritesShareableUnderArtifactsPath</IncrementalCleanDependsOn>
54+
<!-- By default MSBuild won't allow tracking/automatic clean-up of files that are outside of a Project's child directory structure.
55+
This flag opts us into a mode where the Common targets will track and clean such files, which is good because
56+
in Artifacts layout virtually all transitive and package references are such files.
57+
See https://github.com/dotnet/msbuild/pull/12096 for full details. -->
58+
<TrackFileWritesShareableOutsideOfProjectDirectory>true</TrackFileWritesShareableOutsideOfProjectDirectory>
5659
</PropertyGroup>
5760

5861
<PropertyGroup Condition="'$(UseArtifactsOutput)' == 'true' And '$(ArtifactsPivots)' == ''">
@@ -163,25 +166,4 @@ Copyright (c) .NET Foundation. All rights reserved.
163166

164167
</Target>
165168

166-
167-
<!-- Addresses a gap in the _CleanGetCurrentAndPriorFileWrites:
168-
https://github.com/dotnet/msbuild/blob/25d1e4c409f9efd81c345fb41fbee6d2af83bed6/src/Tasks/Microsoft.Common.CurrentVersion.targets#L5765-L5777
169-
170-
This Target won't remove FileWritesShareable if they aren't under the Project's own directory,
171-
but in Artifacts layout that will never be the case. So we allow finding the FileWritesShareable under our output
172-
paths as well -->
173-
<Target Name="_TrackFileWritesShareableUnderArtifactsPath">
174-
<FindUnderPath Path="$(OutputPath)" Files="@(FileWritesShareable)" UpdateToAbsolutePaths="true">
175-
<Output TaskParameter="InPath" ItemName="_LocatedFileWritesShareable"/>
176-
</FindUnderPath>
177-
<FindUnderPath Path="$(IntermediateOutputPath)" Files="@(FileWritesShareable)" UpdateToAbsolutePaths="true">
178-
<Output TaskParameter="InPath" ItemName="_LocatedFileWritesShareable"/>
179-
</FindUnderPath>
180-
181-
<!-- Remove duplicates from files produced in this build. -->
182-
<RemoveDuplicates Inputs="@(_LocatedFileWritesShareable)" >
183-
<Output TaskParameter="Filtered" ItemName="_CleanCurrentFileWrites"/>
184-
</RemoveDuplicates>
185-
</Target>
186-
187169
</Project>

0 commit comments

Comments
 (0)