dotnet / dotnet/sdk

Incorrect assembly resolved in mixed target environements

Open
#51,142 1 comment 0 reactions 1 assignee Claimed by @baronfel View on GitHub
Area-NetSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
ResolvePackageAssets may resolve incorrect assembly from NuGet in builds where top and dependent project has different TFM targets, top level project nuget TFM runtime assemblies are empty, but dependent TFM assemblies are non empty.

### To Reproduce
Build/publish app/app.csproj from https://gist.github.com/iskiselev/cbd061c782d5333dc284826c3f3ef791

### Further technical details
In specific example, we have next dependency structure:
app.csproj (net471) -> lib.csproj (net462) ->System.ValueType/4.6.1

NuGet resolution should be done in target project TFM. `System.ValueType/4.6.1` has `lib\net471\_._`, which means that no files should be copied to output from nuget package in `net471`. But output folder will have System.ValueType.dll from `lib\net462`. It happens only when lib.dll has reference to System.ValueType.dll (I've not validated behaviour with transitive dependencies over nuget). In that case ResolvePackageAssets will pick up System.ValueType.dll that have been copied to lib.csproj bin folder.

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.