I have a solution with multiple projects. There is a need that I have to refer a different version of the same assembly in two different projects. As of now what is happening is that only the latest version of the dll is getting copied into the bin folder. So the dll that depends on the older version fails with an error
Could not load file or assembly xxxx or one of its dependencies.
The located assembly's manifest definition does not match the
assembly reference.
Is there a way to get the application to use a specific version of dll based on the project?
config. Under <runtime> , add a <codeBase> tag for each version of the DLL. This will resolve the runtime assembly loading conflict. That's it, now we can use both versions as we please.
Because the strong-named assembly's version number is part of its identity, the runtime can store multiple versions of the same assembly in the global assembly cache and load those assemblies at run time.
Solution 1Add a reference to the DLL directly to your new project: open your project in VS, expand the Project branch in the Solution explorer, then right click "References". From the context menu, select "Add Reference..." and wait for the dialog - If can take a little while to appear.
Yes, you can have each project reference a specific version of the same dll. I would suggest putting both versions of the dll in the GAC. In your referencing projects set the Copy Local = false and Specific Version = true.
You could do it without the GAC by using your config file and assembly binding directives (since the shared dlls can't be in the same folder because they have the same name) but this is one of the main problems the GAC was designed to solve. So I would recommend taking advantage of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With