Skip to content

Commit 19f54eb

Browse files
authored
Use NormalizePath instead of Path.Combine for PackagedShimOutputDirectory
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.
1 parent 42ec2db commit 19f54eb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ NOTE: This file is imported from the following contexts, so be aware when writin
295295
ApphostsForShimRuntimeIdentifiers="@(_ApphostsForShimRuntimeIdentifiers)"
296296
IntermediateAssembly="@(IntermediateAssembly->'%(FullPath)')"
297297
OutputType="$(OutputType)"
298-
PackagedShimOutputDirectory="$([System.IO.Path]::Combine($(PackagedShimOutputRootDirectory), 'shims', $(_ToolPackShortTargetFrameworkName)))"
298+
PackagedShimOutputDirectory="$([MSBuild]::NormalizePath($(PackagedShimOutputRootDirectory), 'shims', $(_ToolPackShortTargetFrameworkName)))"
299299
PackageId="$(PackageId)"
300300
PackageVersion="$(PackageVersion)"
301301
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
@@ -324,7 +324,7 @@ NOTE: This file is imported from the following contexts, so be aware when writin
324324

325325
<Target Name="_ComputeExpectedEmbeddedApphostPaths">
326326
<GetEmbeddedApphostPaths
327-
PackagedShimOutputDirectory="$([System.IO.Path]::Combine($(PackagedShimOutputRootDirectory), 'shims', $(_ToolPackShortTargetFrameworkName)))"
327+
PackagedShimOutputDirectory="$([MSBuild]::NormalizePath($(PackagedShimOutputRootDirectory), 'shims', $(_ToolPackShortTargetFrameworkName)))"
328328
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
329329
ToolCommandName="$(ToolCommandName)">
330330

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ Copyright (c) .NET Foundation. All rights reserved.
12891289
</ItemGroup>
12901290

12911291
<GetEmbeddedApphostPaths
1292-
PackagedShimOutputDirectory="$([System.IO.Path]::Combine($(PackagedShimOutputRootDirectory), 'shims', $(TargetFramework)))"
1292+
PackagedShimOutputDirectory="$([MSBuild]::NormalizePath($(PackagedShimOutputRootDirectory), 'shims', $(TargetFramework)))"
12931293
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
12941294
ToolCommandName="$(ToolCommandName)"
12951295
>

0 commit comments

Comments
 (0)