dotnet / dotnet/msbuild

Hard-to-follow logging when NuGet package misrepresents its dependencies

Open
#4,748 0 comments 0 reactions 1 assignee Claimed by @rainersigwald View on GitHub
Area: Debuggability Area: Task: Resolve Assembly References (RAR) triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Steps to reproduce

Use a NuGet package that declares a package dependency on an older version of a package than the actual assembly reference in the package. For instance:

[lying-nuget-package.zip](https://github.com/microsoft/msbuild/files/3632278/lying-nuget-package.zip)

### Expected behavior

A clear, actionable error describing the conflict.

### Actual behavior

```
There was a conflict between "StreamJsonRpc, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "StreamJsonRpc, Version=2.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:18)
"StreamJsonRpc, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "StreamJsonRpc, Version=2.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. (TaskId:18)
References which depend on "StreamJsonRpc, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Users\raines\.nuget\packages\streamjsonrpc\2.1.55\lib\netstandard2.0\StreamJsonRpc.dll]. (TaskId:18)
C:\Users\raines\.nuget\packages\streamjsonrpc\2.1.55\lib\netstandard2.0\StreamJsonRpc.dll (TaskId:18)
Project file item includes which caused reference "C:\Users\raines\.nuget\packages\streamjsonrpc\2.1.55\lib\netstandard2.0\StreamJsonRpc.dll". (TaskId:18)
C:\Users\raines\.nuget\packages\streamjsonrpc\2.1.55\lib\netstandard2.0\StreamJsonRpc.dll (TaskId:18)
References which depend on "StreamJsonRpc, Version=2.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. (TaskId:18)
C:\Users\raines\.nuget\packages\microsoft.visualstudio.utilities\16.4.29317.144\lib\net46\Microsoft.VisualStudio.Utilities.dll (TaskId:18)
Project file item includes which caused reference "C:\Users\raines\.nuget\packages\microsoft.visualstudio.utilities\16.4.29317.144\lib\net46\Microsoft.VisualStudio.Utilities.dll". (TaskId:18)
C:\Users\raines\.nuget\packages\microsoft.visualstudio.utilities\16.4.29317.144\lib\net46\Microsoft.VisualStudio.Utilities.dll (TaskId:18)
...
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "StreamJsonRpc" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. [S:\work\lying-nuget-package\lying-nuget-package.csproj]
```

It's not clear why those paths are relevant, since they came in through NuGet package references.

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.