Skip to content

Commit 578eba8

Browse files
committed
Fix tool shim output path calculation
1 parent 2444c06 commit 578eba8

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
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
@@ -256,7 +256,7 @@ Copyright (c) .NET Foundation. All rights reserved.
256256
ApphostsForShimRuntimeIdentifiers="@(_ApphostsForShimRuntimeIdentifiers)"
257257
IntermediateAssembly="@(IntermediateAssembly->'%(FullPath)')"
258258
OutputType="$(OutputType)"
259-
PackagedShimOutputDirectory="$(PackagedShimOutputRootDirectory)shims/$(_ToolPackShortTargetFrameworkName)"
259+
PackagedShimOutputDirectory="$([System.IO.Path]::Combine($(PackagedShimOutputRootDirectory), 'shims', $(_ToolPackShortTargetFrameworkName)))"
260260
PackageId="$(PackageId)"
261261
PackageVersion="$(PackageVersion)"
262262
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
@@ -285,7 +285,7 @@ Copyright (c) .NET Foundation. All rights reserved.
285285

286286
<Target Name="_ComputeExpectedEmbeddedApphostPaths">
287287
<GetEmbeddedApphostPaths
288-
PackagedShimOutputDirectory="$(PackagedShimOutputRootDirectory)shims/$(_ToolPackShortTargetFrameworkName)"
288+
PackagedShimOutputDirectory="$([System.IO.Path]::Combine($(PackagedShimOutputRootDirectory), 'shims', $(_ToolPackShortTargetFrameworkName)))"
289289
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
290290
ToolCommandName="$(ToolCommandName)">
291291

test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,7 @@ public void It_uses_customized_PackagedShimOutputRootDirectory(bool multiTarget,
157157

158158
var packCommand = new PackCommand(Log, helloWorldAsset.TestRoot);
159159

160-
var result = packCommand.Execute("-bl:{}");
161-
if (Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is string uploadRoot)
162-
{
163-
var binlogFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.binlog");
164-
foreach (string binlogFile in binlogFiles)
165-
{
166-
File.Copy(binlogFile, Path.Combine(uploadRoot, Path.GetFileName(binlogFile)), true);
167-
}
168-
}
169-
result.Should().Pass();
160+
var result = packCommand.Execute().Should().Pass();
170161

171162
string windowShimPath = Path.Combine(shimoutputPath, $"shims/{targetFramework}/win-x64/{_customToolCommandName}.exe");
172163
File.Exists(windowShimPath).Should().BeTrue($"Shim {windowShimPath} should exist");

0 commit comments

Comments
 (0)