New SDK Tool generation has trouble packing nested files that are not directly in the tool root
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
While looking at making the [Aspire.Cli](https://github.com/dotnet/aspire/compare/hacks-to-make-tools?expand=1) pack as our new multi-RID tools, I discovered a gap in our handling of packing the published assets for a Tool. It appears that when we create the expected `PackagePath` metadata for our included files, we do not take subdirectories into account.
### To Reproduce
* clone https://github.com/dotnet/aspire
* checkout the `hacks-to-make-tools` branch
* in the 'src\Aspire.Cli\Aspire.Cli.Tool.csproj` remove the `WarningsNotAsErrors` property
* run `dotnet pack -bl`
* get ~60 NU5118 errors from language-specific resources all having the same PackagePath metadata:
### Exceptions (if any)
Many instances of:
> C:\Program Files\dotnet\sdk\10.0.100-preview.6.25358.103\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): error NU5118: Warning As Error: File 'D:\Code\aspire\artifacts\bin\Aspire.Cli.Tool\Release\net8.0\publish\zh-Hant\System.CommandLine.resources.dll' is not added because the package already contains file 'tools\net8.0\any\System.CommandLine.resources.dll'
### Further technical details
We need to take the relative directory path from the PublishDir to the file's containing directory into account when creating the `PackagePath`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.