.NET SDK flattens all assets under '\runtimes\win-<ARCH>\native'
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
I'm hitting some issues when consuming a NuGet package that contains some assets in the native folder, like so:

My expectation would be that those assets would be copied to the output folder **preserving the relative folder structure**. This matches the behavior of the classic MSBuild tooling when consuming the package from a legacy UWP project. However, I noticed that when targeting .NET 9, everything gets flattened to the root instead. Looking at the binlog it seems this behavior is a result of the .NET SDK itself? I see this:

It seems like the target paths of all those assets are reset to always just point to the root output folder? For context:
- Here's a binlog: [msbuild.binlog](https://microsoft-my.sharepoint-df.com/:u:/p/sergiopedri/Ee2JmdPPfAtElQhJesfT8k0Bax0vQbByJgiIqaV8vaLxmQ?e=ZlUXa5) (MSFT only)
- Here's a minimal repro: [test.zip](https://microsoft-my.sharepoint-df.com/:u:/p/sergiopedri/Ee2JmdPPfAtElQhJesfT8k0Bax0vQbByJgiIqaV8vaLxmQ?e=0bHo0Y) (MSFT only)
I have a few questions:
- Is this intended, or is it a bug?
- Is there a way to restore the previous behavior and preserve the target folder structure?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.