-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make it so the artifacts folders register files for cleanup #49595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it so the artifacts folders register files for cleanup #49595
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the SDK to properly register files within artifacts folders for cleanup and provides accompanying tests.
- Adds a test in ArtifactsOutputPathTests.cs to verify that published files (e.g., hostfxr.dll) are correctly cleaned up when building in Release configuration.
- Updates the Microsoft.NET.DefaultOutputPaths.targets to include a new target _TrackFileWritesShareableUnderArtifactsPath ensuring file writes under both OutputPath and IntermediateOutputPath are tracked for cleanup.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs | Adds tests to verify cleanup behavior for artifacts folders |
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DefaultOutputPaths.targets | Enhances cleanup logic by tracking file writes under artifacts output directories |
Instead of duplicating some MSBuild logic, would it make sense to update MSBuild so that (with an opt-in from the SDK) it would also look under the output and intermediate output paths in addition to the project directory? |
That's also very reasonable, and much more clean. I can set that up for sure. |
When dotnet/msbuild#12096 is merged, I'll update this to just set the new property (and keep the existing tests). |
The change has flowed to the VMR this morning, so the next VMR->SDK flow should let us merge this. |
a2c6fe6
to
d266bc4
Compare
Once #49740 merges this can be rebased and the tests should light up. |
d266bc4
to
6f71ec0
Compare
6f71ec0
to
d9f4a44
Compare
Fixes #49582
The SDK knows that it's opting into Artifacts Path, and so the SDK can coordinate correcting the cleanup behavior for ArtifactsPath.