Skip to content

Commit f9037b3

Browse files
Copilotjoperezrbaronfel
authored
Optimize _MvcCopyDependencyFiles and _GeneratePublishTestManifest targets to reduce Copy task overhead (#63994)
* Initial plan * Optimize _MvcCopyDependencyFiles target to reduce Copy task invocations Co-authored-by: joperezr <[email protected]> * Also optimize _GeneratePublishTestManifest target for consistency Co-authored-by: joperezr <[email protected]> * Fix MSBuild item list handling and condition syntax per review feedback - Use new item list _DepsFilesToPublishResolved from FullPath metadata instead of overwriting _DepsFileToPublish - Change condition syntax from '@(list) != empty' to '@(list->Count()) > 0' to avoid list rendering overhead Co-authored-by: baronfel <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: joperezr <[email protected]> Co-authored-by: baronfel <[email protected]>
1 parent 9b3858c commit f9037b3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.targets

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@
5555
</ItemGroup>
5656

5757
<GenerateMvcTestManifestTask ManifestPath="$(PublishDir)MvcTestingAppManifest.json" Projects="@(_PublishManifestProjects)" />
58-
<Copy SourceFiles="%(_DepsFileToPublish.FullPath)" DestinationFolder="$(PublishDir)" Condition="Exists('%(_DepsFileToPublish.FullPath)')" />
58+
59+
<ItemGroup>
60+
<_DepsFilesToPublishResolved Include="%(_DepsFileToPublish.FullPath)" Condition="Exists('%(_DepsFileToPublish.FullPath)')" />
61+
</ItemGroup>
62+
63+
<Copy SourceFiles="@(_DepsFilesToPublishResolved)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="true" Condition="@(_DepsFilesToPublishResolved->Count()) > 0" />
5964
</Target>
6065

6166
<Target Name="_MvcCopyDependencyFiles" AfterTargets="Build;_ResolveMvcTestProjectReferences" Condition="'$(TargetFramework)'!=''">
@@ -70,11 +75,16 @@
7075
<_CreateSymbolicLinksForMvcCopyDependencyFilesIfPossible Condition="'$(_CreateSymbolicLinksMvcCopyDependencyFilesIfPossible)' == ''">$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)</_CreateSymbolicLinksForMvcCopyDependencyFilesIfPossible>
7176
</PropertyGroup>
7277

73-
<Copy SourceFiles="%(DepsFilePaths.FullPath)"
78+
<ItemGroup>
79+
<_DepsFilesToCopy Include="@(DepsFilePaths)" Condition="Exists('%(DepsFilePaths.FullPath)')" />
80+
</ItemGroup>
81+
82+
<Copy SourceFiles="@(_DepsFilesToCopy)"
7483
DestinationFolder="$(OutDir)"
7584
UseHardlinksIfPossible="$(_CreateHardLinksForMvcCopyDependencyFilesIfPossible)"
7685
UseSymboliclinksIfPossible="$(_CreateSymbolicLinksForMvcCopyDependencyFilesIfPossible)"
77-
Condition="Exists('%(DepsFilePaths.FullPath)')" />
86+
SkipUnchangedFiles="true"
87+
Condition="@(_DepsFilesToCopy->Count()) > 0" />
7888
</Target>
7989

8090
</Project>

0 commit comments

Comments
 (0)