nuget packages, their dlls and assembly binding errors

1

Take a package like Microsoft.AspNetCore.Http.Abstractions, it depends on Microsoft.AspNetCore.Http.Features by this line in its nuspec:

<dependency id="Microsoft.AspNetCore.Http.Features" version="2.1.1" exclude="Build,Analyzers" />

with the 2.1.1 meaning >= 2.1.1, in nuget parlance.

So I take a dependency on Microsoft.AspNetCore.Http.Abstractions, version 2.1.1 exactly in my project.

Currently, there is both a version 2.1.1 and 2.2 of Microsoft.AspNetCore.Http.Features in nuget, so my project ends up with Microsoft.AspNetCore.Http 2.1.1 and Microsoft.AspNetCore.Http.Features 2.2.

But then, I run my project and I get assembly binding errors, because the actual Microsoft.AspNetCore.Http.Abstractions 2.1.1 dll depends on Microsoft.AspNetCore.Http.Features 2.1.1.

TLDR Nuspec says >= 2.1.1, dll is bound to == 2.1.1

This seems to be true for almost all MS packages.

Is this a monumental cockup, or am I doing something wrong? I'm having to traverse the dependnecy graphs myself and lock myself to each exact version which each dlls needs, because the nuspecs dont appear to be properly configured.

Whats going on?

Example binding error:

Unable to load one or more types: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

(because ive been given 2.2 by nuget)

nuget
asked on Stack Overflow Jan 22, 2019 by Andrew Bullock

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0