Enlighten FindUnderPath and AssignTargetPath tasks#13069
Merged
AR-May merged 13 commits intodotnet:mainfrom Feb 19, 2026
Merged
Enlighten FindUnderPath and AssignTargetPath tasks#13069AR-May merged 13 commits intodotnet:mainfrom
AR-May merged 13 commits intodotnet:mainfrom
Conversation
AR-May
commented
Jan 20, 2026
AR-May
commented
Jan 20, 2026
69fb9af to
22d83b3
Compare
AR-May
commented
Jan 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the FindUnderPath and AssignTargetPath tasks to MSBuild’s multi-threadable task API by introducing TaskEnvironment-based path resolution, aligning with the ongoing effort in #13025 to transfer remaining tasks to the new API.
Changes:
- Mark
FindUnderPathandAssignTargetPathas[MSBuildMultiThreadableTask]and implementIMultiThreadableTaskwith aTaskEnvironmentproperty. - Replace
Path.GetFullPath/Directory.GetCurrentDirectoryusage withTaskEnvironment.GetAbsolutePath(...)andTaskEnvironment.ProjectDirectory. - Update unit tests to initialize
TaskEnvironmentviaTaskEnvironmentHelper.CreateForTest().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/Tasks/ListOperators/FindUnderPath.cs | Migrates full-path resolution to TaskEnvironment for multithreaded execution. |
| src/Tasks/AssignTargetPath.cs | Uses TaskEnvironment for absolute paths and replaces current-directory logic with ProjectDirectory. |
| src/Tasks.UnitTests/FindUnderPath_Tests.cs | Sets TaskEnvironment in tests to support IMultiThreadableTask execution. |
| src/Tasks.UnitTests/AssignTargetPath_Tests.cs | Sets TaskEnvironment in tests to support IMultiThreadableTask execution. |
Comments suppressed due to low confidence (1)
src/Tasks/AssignTargetPath.cs:117
- Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
if (itemSpecFullFileNamePath.Value.StartsWith(fullRootPath.Value, StringComparison.OrdinalIgnoreCase))
{
// The item spec file is in the "cone" of the RootFolder. Return the relative path from the cone root.
targetPath = itemSpecFullFileNamePath.Value.Substring(fullRootPath.Value.Length);
}
else
{
// The item spec file is not in the "cone" of the RootFolder. Return the filename only.
targetPath = Path.GetFileName(Files[i].ItemSpec);
}
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JanProvaznik
approved these changes
Feb 17, 2026
This was referenced Feb 19, 2026
JanProvaznik
added a commit
to JanProvaznik/msbuild
that referenced
this pull request
Feb 25, 2026
Enlighten FindUnderPath and AssignTargetPath tasks. Related to dotnet#13025 --------- Co-authored-by: Jan Provazník <janprovaznik@microsoft.com>
tommcdon
added a commit
that referenced
this pull request
Mar 16, 2026
…parators (#13369) Investigation from VS feedback item https://developercommunity.visualstudio.com/t/MSIX-Deployed-App-Fails-to-Find-Resource/11049946 led to finding of this issue ### Context `AssignTargetPath` task in VS 18 Preview build to new code path gated behind `ChangeWaves.Wave18_5` that uses `AbsolutePath.GetCanonicalForm()` instead of the previous `Path.GetFullPath()` for path normalization. `GetCanonicalForm()` doesn't normalize consecutive directory separators (`\\` → `\`), unlike `Path.GetFullPath()` which did. This resulted in a "flattening" of the TargetPath, breaking the a Visual Studio deployment scenario. Regression was introduced on #13069. ### Changes Made [AbsolutePath.GetCanonicalForm()](https://github.com/dotnet/msbuild/blob/7d73e8e9074fe9a4420e38cd22d45645b28a11f7/src/Framework/PathHelpers/AbsolutePath.cs#L142) has a fast-path optimization that skips calling [Path.GetFullPath()](https://github.com/dotnet/msbuild/blob/7d73e8e9074fe9a4420e38cd22d45645b28a11f7/src/Framework/PathHelpers/AbsolutePath.cs#L172) when the path has no relative segments (/. or \.) and no mixed separators (/ on Windows). However, it didn't check for consecutive directory separators (e.g., \\), so paths like ...win-x64\\ were returned unchanged. The fix adds a check for consecutive separators (\\ on Windows, // on Unix) so they fall through to [Path.GetFullPath()](https://github.com/dotnet/msbuild/blob/7d73e8e9074fe9a4420e38cd22d45645b28a11f7/src/Framework/PathHelpers/AbsolutePath.cs#L172) which normalizes them to a single separator. ### Testing Added the appropriate unit tests. Also validated the originally reported issue in the VS feedback ticket by patching binaries in VS.
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.
Related to #13025