DLL version mismatch: The located assembly's manifest definition does not match the assembly reference

2.7k views Asked by At

I have a legacy project in Visual Studio 2003 that was made in the past by other developers.

This project has some references added. One of them, let's say myDLL.dll. It has the properties below in VS:

  • Copy Local = True
  • Runtime Version v1.1.4322
  • Strong Name: True
  • Type: Assembly
  • Version: 2.1.1.30200

I build the solution and copy it in the target path in production machine. In the target I have ensured that myDLL.dll is the same version as in the VS solution, that is, 2.1.1.30200.

When I executed the new version of the app in production machine below error is shown in my app logs:

The located assembly's manifest definition with name 'myDLL' does not match the assembly reference.

I guess that in GAC is loaded/installed a previous version of this DLL so hence the above exception.

So, I wonder if GAC is automatically cleaned from time to time (on a regular basis) or do I need to remove manually the old DLL and install the new one?

If I need to remove the old one and install the new one in the production machine, how can I do it?

Additionally, if I go to C:\Windows\assembly in production machine I can find the DLL myDLL but the version indicated is 2.1.0.0 instead of 2.1.x.x. Why? Shouldn't it be 2.1.1.30200 (for the new one) or 2.1.1.20100 (for the old one)?

I have read a lot of posts here, like below ones:

Other interesting links that I have found:

but I am very newbie in GAC.

1

There are 1 answers

4
Tiber Septim On

Have you tried to put the myDLL.dll into the same directory where your output program is located? For web projects it is "bin" directory, for EXE just keep them together in the same folder. So it will be loaded from application directory, not from the GAC.