Eilidh
Eilidh

Reputation: 1298

DLL Hell - My application throws an error if Version 6.9.3.0 OR 6.8.3.0 of MySql.Data.dll is missing

Problem Context

I have written an application in C# which uses a MySqlConnector. I've added MySql.Data.dll (Version 6.9.3.0) 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 6.8.3.0. (...etc...)' or one of its dependencies. The located assembly's manifest description does not match the assembly reference. File name: 'MySql.Data, Version=6.8.3.0, (...etc...).

Obviously it is looking for Version 6.8.3.0 but only finding Version 6.9.3.0 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


Additional Information

My app.config file -

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

Upvotes: 7

Views: 801

Answers (1)

Eilidh
Eilidh

Reputation: 1298

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 6.8.3.0. and 6.9.3.0. simultaneously - however by specifying a specific version it doesn't "confuse itself" and just goes for 6.9.3.0., which is there.

Upvotes: 4

Related Questions