Bug #64707 My Visual Studio still trying to use the old version of MySQL Connector
Submitted: 20 Mar 2012 17:49 Modified: 8 Jun 2012 10:23
Reporter: Philippos Manetas Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.5.4 OS:Windows
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: connector, csharp, NET, UPDATE

[20 Mar 2012 17:49] Philippos Manetas
Description:
Hello,

this bug is messing with me for years but first time i got so deep in programming a software that i cant just delete the software and start over again, just to use a new update of MySQL connector for .net csharp.

So here is the problem and what did i do exactly:

On all machines, my software works fine. But for a weird reason, on my 'super' PC that is faster than all other machines, i got some delays on communicate between MySQL server and my software. So the first comes in my mind is to upgrade my MySQL Connector hopping it have some bugs that been patched. So i took the steps slowly as it is: uninstall my connector from window's default "add/remove". 
Download MySQL Connector/Net 6.5.4. Install it. Open my project in Microsoft visual studio 2008, Remove MySQL.Data from references, add it again, using the new version, and set the MySQL's properties "copy = true" (read it from other articles but still didn't work for me). The problem is when i try to do something new from my datasets, for example drug and drop a GRID, a message shown up with this error: 

"Code generation of property 'Connection' failed. Error was: 'Property accessor 'Connection' on object 'tableAdapterManager' threw the following exception:'Could not load file or assembly 'MySql.Data, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5.......' or one of its dependencies. The system cannot find the file specified."

make note version 6.4.4.0 was my old version of MySQL connector that i uninstall from my system. I also check my manifest from bin\Debug folder, and the version was correct:

"<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MySql.Data.dll" size="377856">
      <assemblyIdentity name="MySql.Data" version="6.5.4.0" publicKeyToken="C5687FC88969C44D" language="neutral" processorArchitecture="msil" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
        <dsig:DigestValue>rUrXzgL7D9SImrBigQNlczN/4kQ=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>"

Can anyone assist me please?

regards,

Philip Manetas

How to repeat:
Can be repeat by upgrading mysql connector.(?)
[20 Mar 2012 17:52] Philippos Manetas
"copy local = true"
[13 Apr 2012 9:53] Bogdan Degtyariov
Philippos,

Thank you for the detailed description of the problem.
Can you check your app.config file? Perhaps it contains the references to the old version 6.4.4?

Thanks.
[13 Apr 2012 12:28] Philippos Manetas
It doesn't referenced to any mysql connector version atall. Here is my app code (hiding personal information):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="MySoftware.Properties.Settings.MySoftwareConnectionString"
            connectionString="server=localhost;user id=blabla;persist security info=True;database=mydatabase;password=blabla;"
            providerName="MySql.Data.MySqlClient" />
        <add name="MySoftware.Properties.Settings.MyOnlineConnectionString"
            connectionString="server=blabla;user id=blabla;persist security info=True;database=blabla;use procedure bodies=False;password=blabla;"
            providerName="MySql.Data.MySqlClient" />
    </connectionStrings>
</configuration>
[16 Apr 2012 9:45] Bogdan Degtyariov
Very strange, the version 6.4.4 must be referenced somewhere to produce such error. Did you check your machine.config file?
[16 Apr 2012 12:33] Philippos Manetas
Yes this is what i though too. So i search every file in my project looking for a 6.4.4 match, without any results. What is machine.config? never hear of it and cannot find it.
[16 Apr 2012 13:14] Bogdan Degtyariov
machine.config is the configuration file, which applies settings to the entire computer. You can check more details here:

http://msdn.microsoft.com/en-us/library/ms229697%28v=vs.71%29.aspx
[16 Apr 2012 22:34] Philippos Manetas
Still cannot find it, can you please help me out finding it?

im using Windows 7 32bit & Microsoft Visual Studio
[16 Apr 2012 22:35] Philippos Manetas
Microsoft Visual Studio 2008*
[17 Apr 2012 5:19] Bogdan Degtyariov
Please try looking in Windows\Microsoft.NET\Framework and its subdirectories.
The machine.config files for NET Framework v2 and v4 are located in the following directories on my Win7 machine:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config 
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

So, you should choose the file corresponding to the runtime versions used by your application (v2 or v4).
[17 Apr 2012 13:44] Philippos Manetas
Thank you for the help finding out.

I checked my application's framework and it is v3.5.
But machine.config does not exist in that folder, so i just did a search on 
folder framework. The result came out in v2.

The good news is i found multiple lines that includes the 6.4.4 connector in.
The question now is, how do i fix this? should i replace all match 6.4.4 with my current version or just remove all lines? This lines also reference to a publickey and i think it will make a problem right if i just replace them with the current version.
[1 May 2012 7:12] Bogdan Degtyariov
Philippos,

we do not distribute Connector/NET driver for Framework 3.5.
There are only two types of MySql.Data.dll files: for Framework v2.0 and v4.0.
Hence, if your application is targeted for Framework v3.5 it should use MySql.Data.dll for Framework v2.0.

Also, when something is not going well during install/uninstall (Visual Studio is running or something like that), the machine.config file might not be updated.
So, you need to remove the entry corresponding to the NET driver 6.4.4 and then install the version 6.5.4. Then check machine.config when it is done.
[2 Jun 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[2 Jun 2012 8:58] Philippos Manetas
Sorry for not sending a feedback, i didn't try it yet since
im working on windows 8 machine at the moment. I will save this bug log
to try it when i have time. I'm sure this was the problem so no need for the ticket to be open any more.

Thanks a million for your help, atleast now i know how to solve this problem.

regards,

Philippos Manetas.

P.S: this conversation will be logged to my account? so i can check it after a while if i want? or it will be removed?
[8 Jun 2012 10:23] Bogdan Degtyariov
Philippos,

I will close the bug, but the conversation will still be 
available at the same address. 

http://bugs.mysql.com/bug.php?id=64707

Also, you are always welcome
to reopen it if you discover new details.
[17 Jul 2012 23:41] Pawel Kraszewski
Hi, I have same problem as http://bugs.mysql.com/bug.php?id=64707 since I've updated MySQL from 6.4.4.0 to 6.5.4.0 version.

Code generation for property 'Connection' failed. Error was:
'Property accessor 'Connection' on object
'tableAdapterManager6' threw the following exception:'Could
not load file or assembly 'MySql.Data, Version=6.4.4.0,
Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx' or one of
its dependencies. The system cannot find the file specified." 

I checked:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config 
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

I replaced References.

Manifest has not been created.

I work with:
Windows 7 ultimate 64;
Visual Studio 2010;

This is my app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx" >
            <section name="automat.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <connectionStrings>
        <add name="automat.Properties.Settings.ConnectionString"
            connectionString="server=localhost;User Id=root;password=xxxxxxxxxxxxxxxx;Persist Security Info=True;database=mydb"
            providerName="MySql.Data.MySqlClient" />
    </connectionStrings>
</configuration>

every think seems to be ok but exception message still occur.

With new projects problem does not exist only with those created before.