Resolving Assembly Reference conflicts (2)

Jan 14, 2017  

In a previous blog post I explored the solution recommended by Microsoft to resolve MSB3247 warnings, but it proved to be a little bit too tedious.

While converting the Lydia solution to .NET Standard instead of the plain old PCLs, I came again across the annoying compilation warning:

No Way to Resolve Conflict Between “Foo.Bar, Version=” and “Foo.Bar, Version=”…

My project was referencing version, but somehow one of the other references required version I was clueless.

I considered inspecting manually every referenced assembly with Reflector to identify the culprit, but since I have several dozens of references, I decided that I needed a tool…

AsmSpy to the rescue

Once more, StackOverflow provided a solution (note that this is the same question as the one I referred to in my previous post). Reading again the replies, I discovered AsmSpy, a tool written by Mike Hadlow which does exactly what I needed: analyze all assemblies found in a folder (such as bin/Debug) and dump the list of all references.

You’ll find AsmSpy on GitHub and some details in Mike’s blog.

Here is a typical dump from AsmSpy bin\Debug command:

Reference: Foo.Bar by Shared.Blah by Foo.Consumer

So the culprit was Shared.Blah which was still referencing an old version of Foo.Bar. Since I was the author of Shared.Blah, I could simply update it.

Otherwise, I would have had to define a <bindingRedirect> as explained here.