Migrate DownloadFile task to use TaskEnvironment API#13113
Merged
JanProvaznik merged 2 commits intomainfrom Feb 6, 2026
Merged
Migrate DownloadFile task to use TaskEnvironment API#13113JanProvaznik merged 2 commits intomainfrom
JanProvaznik merged 2 commits intomainfrom
Conversation
Contributor
|
Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo. |
Member
|
@copilot try again |
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Member
|
blocked by #13120 |
JanProvaznik
approved these changes
Feb 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the DownloadFile task to the new multithreadable task pattern so that path resolution is thread-safe and aligned with the TaskEnvironment API used by other file I/O tasks.
Changes:
- Marked
DownloadFileas a multithreadable task ([MSBuildMultiThreadableTask]) and implementedIMultiThreadableTaskwith aTaskEnvironmentproperty. - Switched destination folder resolution in
DownloadFilefrom directly usingDestinationFolder.ItemSpectoTaskEnvironment.GetAbsolutePath(...)to avoid process-global current-directory state. - Updated
DownloadFileunit tests to initializeTaskEnvironmentviaTaskEnvironmentHelper.CreateForTest()wherever the task is instantiated and uses file system paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Tasks/DownloadFile.cs |
Makes DownloadFile multi-threadable and uses TaskEnvironment.GetAbsolutePath to resolve the destination folder path before creating the directory. |
src/Tasks.UnitTests/DownloadFile_Tests.cs |
Ensures tests explicitly set TaskEnvironment for DownloadFile instances so the new API is exercised safely under the test harness. |
JanProvaznik
added a commit
to JanProvaznik/msbuild
that referenced
this pull request
Feb 25, 2026
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > Migrate the DownloadFile task to use TaskEnvironment API based on the pattern used here: dotnet#12914 > > Make sure to preserve correctness, performance and that the tests pass </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.