0

I'm using NServiceBus in a complicated solution (150+ projects, many of them use NSB). Up until last night, when I couldn't stand it anymore, every project had it's own target directories (./bin/debug and ./bin/release). Because of the dependencies between my projects, I was building and rebuilding the same binaries many times over, so we decided to change to a shared output directory for the whole thing, which dramatically improves the build time of the solution. So far so good...

However, when I tried to start up my project, it fails to start giving me the error:

Warning 1 : Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets 1697    5   My.Assembly.Goes.Here

Uh, oh. So, I dutifully turn up the log verbosity, clean and rebuild the whole mess, to find this in the log output:

30>------ Build started: Project: My.Assembly.Goes.Here, Configuration: Debug Any CPU ------
28>Building with tools version "12.0".

<Lots of stuff omitted...>

28>  There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes".
28>      "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" was not.
28>      References which depend on "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll].

<etcetera...>

Out comes Dependency Walker (great tool, btw). OK, so what's depending on the old 2.0 framework? Look for every reference to mscorlib and ... One of these things is not like the other...

enter image description here

NServiceBus.Hosting.Azure takes a dependency on Ionic.Zip.dll which, in turn, takes a dependency on the 2.0.0.0 version of mscorlib.dll. Ouch. FWIW, the version of NServiceBus.Hosting.Azure that does so is 5.3.2.0.

This looks to me to be similar to the issue here: https://github.com/Particular/NServiceBus/issues/664

Can I get around this with an Assembly Binding Redirect? Is there some way for me to tell NSB to tell Ionic.Zip.dll that the 4.0.0.0 version of mscorlib.dll is fine, thank you very much?

Or is this an NSB bug?

Thanks in advance.

Adam Hoffman
  • 723
  • 6
  • 13
  • We opened [an issue here](https://github.com/Particular/NServiceBus.Host.AzureCloudService/issues/38) – Sean Farmar May 12 '16 at 16:44
  • Thanks Sean. Any updates on timing for a patch appreciated. We're at a block here - researching other paths (might have to upgrade NSB to V5, but that's a heavy lift at this point for us). – Adam Hoffman May 23 '16 at 22:29

1 Answers1

2

A binding redirect on mscorlib should work in my opinion, or you could try a binding redirect on a newer version of dotnetziplib (Ionic) that targets 4.0

Yves Goeleven
  • 2,185
  • 15
  • 13
  • I've been playing with binding redirects, and can't get it running yet. I'll let you know if I get it working. – Adam Hoffman May 13 '16 at 18:44
  • Never managed to get the binding redirects to work. Will research a newer version of dotnetziplib - maybe that will help... – Adam Hoffman May 23 '16 at 22:27