dotnet / dotnet/msbuild

[Bug]: Transitive ProjectReference copied even when hidden with PrivateAssets

Open
#9,612 2 comments 1 reaction 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

If I have app.csproj > lib2.csproj >(private) lib1.csproj

lib1 should not be present in the output of directory of app, but it is. This is due to RAR's `FindDependencies` behavior. It sees the reference from lib2 to lib1 in metadata, and see's lib1 in lib2's output directory, so it's added to copy.

Unfortunately there's no public property to control RAR's `FindDependencies` parameter. One can specify `_FindDependencies`, as mentioned here to workaround:
https://github.com/dotnet/msbuild/blob/8215fb194d24cba1971476188ad97e5498fd2dfb/documentation/wiki/ResolveAssemblyReference.md?plain=1#L40-L45C1

`_FindDependencies` isn't publicly documented, nor is there any way to disable this copying as far as I can tell.

### Steps to Reproduce

Build attached repro.
[privateProjectRef.zip](https://github.com/dotnet/msbuild/files/13868644/privateProjectRef.zip)

### Expected Behavior

lib1.dll does not appear in app's output.

### Actual Behavior

lib1.dll is copied to app's output.

### Analysis

_No response_

### Versions & Configurations

_No response_

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.