dotnet / dotnet/sdk

.NET SDK flattens all assets under '\runtimes\win-<ARCH>\native'

Open
#49,416 0 comments 0 reactions 1 assignee Claimed by @MiYanni View on GitHub
Area-NetSDK untriaged
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:

![Image](https://github.com/user-attachments/assets/6cfcdbcd-c493-465b-85d6-e5ee0911641a)

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:

![Image](https://github.com/user-attachments/assets/1f7cb192-950f-4816-8917-f52a2e3a0a54)

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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.