DLL Hell – My application throws an error if Version OR of MySql.Data.dll is missing Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of DLL Hell – My application throws an error if Version OR of MySql.Data.dll is missing without wasting too much if your time.

The question is published on by Tutorial Guruji team.

Problem Context

I have written an application in C# which uses a MySqlConnector. I’ve added MySql.Data.dll (Version to the References – this all works as expected on my PC (running Windows 7). However, starting with recent builds, when I try to run the application on another PC (running Windows XP), it throws an Exception on startup.

I added an UnhandledExceptionEventHandler which shows the error Could not load file or assembly 'MySql.Data, Version (...etc...)' or one of its dependencies. The located assembly's manifest description does not match the assembly reference. File name: 'MySql.Data, Version=, (...etc...).

Obviously it is looking for Version but only finding Version in the References – but what I want to know is why it is looking for this version when it worked correctly with earlier builds, and how I can specify which version of MySql to look for.

I know I could just add another reference to the earlier version of the .dll, but I want to understand why this is happening.

Steps taken to attempt to diagnose the problem

  • Checked the project’s References after seeing this question on Stack Overflow and confirming that a reference to MySql.Data.dll has been added to the project, along with its version (

  • Searched for results relating to the Exception error message and found this article on Stack Overflow describing its cause (which I was aware of, but it confirms it)

  • A colleague asked me to confirm that the SpecificVersion property of the MySql.Data Reference is set to False (it is).

  • Tried adding an assembly binding to the config as suggested in an answer below – it does not help, the same error is thrown.

  • Replaced the MySqlData.dll on the other PC with version as a ‘dirty fix’ to see what happened. It now throws the same error as before, but for missing

  • Asked a colleague to run the application on his (Windows 7) PC – no error was generated and it worked as expected.

  • I tried using the Dependency Walker utility on the .exe as a commenter suggested but it only showed the following .dlls missing – IESHIMS.DLL (on both PCs), WER.DLL (on the XP PC), and GPSVC.DLL (on my PC). There was nothing about MySql.Data.dll. (Though I have since learned this is not a useful tool in this case – see this question.)

  • On a whim, I decided to change the SpecificVersion property of MySql.Data Reference to True – this fixes the problem.

Additional Information

My app.config file –

<?xml version="1.0"?>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/> 


Changing the SpecificVersionproperty of the MySql.Data Reference to True fixed the problem.

My hypothesis is that the application was somehow simultaneously looking for versions and simultaneously – however by specifying a specific version it doesn’t “confuse itself” and just goes for, which is there.

We are here to answer your question about DLL Hell – My application throws an error if Version OR of MySql.Data.dll is missing - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji