PackageReference "auto-binding" not including correct version
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 139
Description
I have a large solution that I've transitioned over to PackageReference, and I've been having an unbelievably difficult time getting assembly versions to work correctly. As a workaround, I manually added about a hundred or so entries to the `` section of the web.config, but my understanding is that this should be automatically done now. Additionally, every time I update a nuget package, I have to go through and update a dozen or so of these `` entries to match up with what the nuget package dependencies are. To make things worse, some of the old workarounds, such as running a powershell script to update the `` rows or else double clicking an entry in the Visual Studio Warnings window to update an `` don't work when using PackageReference.
Since this isn't a sustainable way to do things, so I'd like to submit this ticket to have you take a look at our setup and figure out why the automatic `assemblyBinding` isn't working as expected.
The most recent exception I'm working through is:
```
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
```
According to the `project.assets.json` file, this assembly is referenced by (a dependency of) two different packages:
1. An internal nuget package has a dependency on version 2.8.1
2. The nuget package "Serilog.Sinks.ApplicationInsights/2.6.0" has a dependency on version 2.5.1.
So, I would expect MSBuild to automatically add an `` to use version 2.8.1, but it does not.
Additionally, if I go into the `\bin` folder, I see version `2.8.1.22898` is present there, which seems correct.
Also, all projects are .Net 4.7.2, which I've read is supposed to help with problems like this, but didn't in our case.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.