0
 X <= nuget package A <= DLL version 1
 X <= nuget package B <= DLL version 2

So my project X references two 3rd party nuget package A and B. Both packages reference the same DLL but with different version. Now the issue seems that at build time, DLLv1 is overriden by DLLv2 in the bin folder. And at runtime, the code in A complains DLLv1 is not found.

I already added an assembly binding config file in the bin folder to bind to DLLv2. But that doesn't seem to change anything.

It's a CSharp project built using msbuild.

Questions:

  1. Is AssemblyBinding the right tool to solve this problem?
  2. What is the proper way to resolve this?
Lee
  • 103
  • 1
  • 11
  • Simple...don't do this. You should have all projects in a solution reference the same version of a package. – David L Mar 09 '17 at 21:41
  • The nuget packages are 3rd party and I have no control over what DLL versions they use. – Lee Mar 09 '17 at 21:50
  • Unless the 3rd party libraries have pinned specific versions, you should be able to manage and install the shared dependency across your consuming projects. You can only have one instance of a filename in your bin. If this doesn't work, you'd need to split your project apart into multiple entrance points, each with a specific version of the common library – David L Mar 09 '17 at 22:00

1 Answers1

0

I found the root cause to my question. My program is running in powershell, and powershell won't load my app's config. I need to make powershell's config to have my bindings.

Lee
  • 103
  • 1
  • 11