Normalize shim output directory in publish scenario - #49801
Merged
Conversation
578eba8 normalized the output path for shims in the pack as tool scenario. However, the publish scenario is unnormalized and the two end up with colliding assets due to path separators. The easiest fix seems to be normalizing all paths.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a path normalization issue in the publish scenario for .NET SDK tools where unnormalized shim output directories were causing asset collisions due to inconsistent path separators. The fix aligns the publish scenario with a previous normalization applied to the pack as tool scenario.
- Normalizes the
PackagedShimOutputDirectorypath usingSystem.IO.Path.Combine()instead of string concatenation - Ensures consistent path formatting between pack and publish scenarios to prevent asset collisions
baronfel
approved these changes
Jul 16, 2025
akoeplinger
approved these changes
Jul 16, 2025
akoeplinger
added a commit
that referenced
this pull request
Jul 18, 2025
…tory Follow-up to #49801 and #49288 We were still seeing an error during publish, note the duplicate slashes: ``` error NETSDK1152: Found multiple publish output files with the same relative path: /__w/1/s/artifacts/bin/dotnet-dump/Debug/shims/net8.0/win-x64/dotnet-dump.exe, /__w/1/s/artifacts/bin/dotnet-dump/Debug//shims/net8.0/win-x64/dotnet-dump.exe, /__w/1/s/artifacts/bin/dotnet-dump/Debug/shims/net8.0/win-x86/dotnet-dump.exe, /__w/1/s/artifacts/bin/dotnet-dump/Debug//shims/net8.0/win-x86/dotnet-dump.exe, /__w/1/s/artifacts/bin/dotnet-dump/Debug/shims/net8.0/osx-x64/dotnet-dump ``` Use the [MSBuild]::NormalizePath property function instead of Path.Combine to get a canonicalized path that doesn't contain duplicate slashes.
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.
578eba8 normalized the output path for shims in the pack as tool scenario. However, the publish scenario is unnormalized and the two end up with colliding assets due to path separators. The easiest fix seems to be normalizing all paths.