From 51c161872aeb7a8b941d6a71dbd98adaf9bc1c80 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Sun, 28 Sep 2025 20:13:29 -0300 Subject: [PATCH] Fix issue with localized resources when packing tools We were missing the %(RecursiveDir) value which caused localized resources to end up as duplicate assets in the package, causing the pack to fail. --- .../NuGetizer.Inference.targets | 2 +- src/NuGetizer.Tests/given_a_tool_project.cs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/NuGetizer.Tasks/NuGetizer.Inference.targets b/src/NuGetizer.Tasks/NuGetizer.Inference.targets index 20d2546d..4fa6164b 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Inference.targets +++ b/src/NuGetizer.Tasks/NuGetizer.Inference.targets @@ -276,7 +276,7 @@ Copyright (c) .NET Foundation. All rights reserved. - $([MSBuild]::ValueOrDefault('%(PackagePath)', '').TrimEnd('/'))/%(PackageFile) + $([MSBuild]::ValueOrDefault('%(PackagePath)', '').TrimEnd('/'))/%(RecursiveDir)%(PackageFile) diff --git a/src/NuGetizer.Tests/given_a_tool_project.cs b/src/NuGetizer.Tests/given_a_tool_project.cs index 498f8447..7cbcd58f 100644 --- a/src/NuGetizer.Tests/given_a_tool_project.cs +++ b/src/NuGetizer.Tests/given_a_tool_project.cs @@ -90,6 +90,27 @@ public void when_pack_as_tool_then_packs_dotnet_tool_runtime_assets() })); } + [Fact] + public void when_pack_as_tool_with_localized_resources_then_packs_dotnet_tool_runtime_assets() + { + var result = Builder.BuildProject(@" + + + MyTool + MyTool + net8.0 + tools + true + + + + +", + "Pack", output); + + result.AssertSuccess(output); + } + [Fact] public void when_pack_folder_tool_but_no_pack_as_tool_then_packs_dependencies_normally() {