Autofac and Microsoft.Bcl.AsyncInterfaces

1.8k Views Asked by At

Visual Studio 2019 provides an unannounced 4.700.19.56404 version of Microsoft.Bcl.AsyncInterfaces here:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Bcl.AsyncInterfaces

Autofac accepts 1.1.0 or greater of this package. However, if I try to update the Microsoft.Bcl.AsyncInterfaces Nuget package to the latest version (5.0.0), I start running into problems where the package gets resolved to the 4.700.19.56404 version because:

21>  Dependency "Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".
21>    Resolved file path is "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Bcl.AsyncInterfaces.dll".
21>      Considered "C:\<repo-location>\bin\Debug\Microsoft.Bcl.AsyncInterfaces.dll",
21>        but its name "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
21>        didn't match the expected name "Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".

And of course when trying to run, I get a runtime error because Microsoft.Bcl.AsyncInterfaces cannot be loaded.

I guess the most obvious question is if there's a way around this via msbuild, e.g., some target that would resolve the dependency at build time to 5.0.0, not 4.700.19.56404.

Otherwise, I think this could be solved by having Autofac updating its Microsoft.Bcl.AsyncInterfaces dependency to 5.0.0 over 1.1.0. Not sure if this is feasible or not.

0

There are 0 best solutions below