[Bug]: ProjectReference.ExcludeAssets ignored for transitive dependencies
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Issue Description
This is sort of an inverse of dotnet/msbuild#4717 .
If you have a project, C, that depends on project B, and project B depends on project A (`C -> B -> A`) and you have the project reference in project C set up like this:
```
false
runtime
```
Then ProjectB.dll is not copied to the output folder, as expected, but ProjectA.dll _is_ copied.
I have tried adding `true` to the project definition in ProjectC.csproj, but then I'm not allowed to use code defined in ProjectA.csproj.
### Steps to Reproduce
- Create three projects, ProjectA, ProjectB, ProjectC.
- Add reference to ProjectA in ProjectB
- Add reference to ProjectB in ProjectC
- Ensure that `runtime` is set for the project reference in ProjectC
- Build ProjectC to see that the bin folder for ProjectC does not contain ProjectB.dll (expected), but it _does_ contain ProjectA.dll (unexpected)
### Expected Behavior
When `runtime` is set on a project reference none of its assets, transitive or not, should be copied to the bin folder
### Actual Behavior
The transitive dependency to ProjectA.dll is copied to the bin folder, while ProjectB.dll is not
### Analysis
_No response_
### Versions & Configurations
Visual Studio Professional 2022 (17.10.4)
MSBuild version 17.10.4+10fbfbf2e for .NET Framework
17.10.4.21802
Windows 11 23H2 22631.3958
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.