Search code examples
c#dllmsbuildconflicting-librariesassemblybinding

Can not load file or assembly or one of its dependencies. The system cannot find the file specified


 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?

Solution

  • 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.