0

I have a web application that has two referenced assemblies in the form of DLLs. Lets call the DLLs Primary.dll and Secondary.dll. The Secondary.dll is dependent upon Primary.dll.

I need to add a feature to Primary.dll for use within the web application. This requires a new version. This new feature is not required by Secondary.dll. There are no breaking changes for Secondary.dll.

Now when a bit of code in Secondary.dll is triggered, I get the following error:

"Could not load file or assembly 'Primary.dll' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. "

Secondary.dll is looking for the specific version of Primary.dll

Is this solved simply by making the SpecificVersion="false" value in the Secondary.dll project file?

If not, I've thought of keeping the older version of Primary.dll in the GAC, this way Secondary.dll would find it there. But would like to avoid this if possible.

So now I'm stuck with having to rebuild and re-version Secondary.dll, with a reference to the updated Primary.dll, every time I make a change to Primary.dll for use by the web application.

Is there way to make it so I don't have to update Secondary.dll's reference to the new version of Primary.dll?

1 Answers1

1

If changes are really not breaking, try this way:

  1. Check assembly attributes of your Primary.dll and get rid of signing and auto-generated assembly version (change 1.0.0.* to 1.0.0.0).
  2. If it doesn't help, open Secondary and Primary with ILSPY utility and check what the exact the reference to the Primary.dll, and compare it to the actual full assembly name of Primary.dll. Also check references to your other dll, that could be referenced in both Primary and Secondary.
  3. If it doesn't help, possible you have several files of Primary.dll assembly with different metadata and assembly loader loads the wrong one. Just find and delete wrong files or use Fusion Log Viewer utility to explore assembly binding. Maybe, this can help.

To make the investigation more simple, use simple almost empty ConsoleApplication with reference to Secondary.dll to play instead of web application.

Community
  • 1
  • 1
olk
  • 199
  • 1
  • 2
  • 8