_MvcCopyDependencyFiles Target is showing up on incremental build hot paths
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
The [`_MvcCopyDependencyFiles`](https://github.com/dotnet/aspnetcore/blob/c07e28bfa41b12fb8f2511948373e86986fd50ca/src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.targets#L66-L88) target does a couple things that make it take more time than necessary:
* The `DepsFilePaths` Item Group is built up via batching, which is not ideal from a perf perspective
* The `Copy` Task is invoked with Batching (`"%(DepsFilePaths.FullPath)"`) which invokes the Task onces for each different item. This is very inefficient
* It's much more efficient to build up item lists for SourceFiles and DestinationFiles input parameters that explicitly map source to destination by matching position, and to alsp specify `SkipUnchangedFiles` as `true` to prevent touching the files on every build, which also causes re-work.
This was found as part of a .NET 10-update analysis for the Copilot team. It's important to fix this because these Targets run for test projects, which are at the 'end' of the build - they are the long tail, and any time spent in them directly extends the overall time of the incremental build.
Contributor guide
Research direction
Start with src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.targets, especially the _MvcCopyDependencyFiles target at lines 66-88. Inspect how DepsFilePaths and the Copy task are batched, then validate an incremental build of a test project and confirm unchanged dependency files are not recopied or touched.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, performance
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100