Friday, 30 October 2009

MySQL Connector - Error with Multiple Versions on Dev Machine - "...column 'InvariantName' is constrained to be unique..."

I installed another version of the MySQL connector on my development machine yesterday, parallel to my existing version - so I now have both 5.0.6 and 5.07 installed. I use these two different versions of it for a couple of different applications I work with. Now however I find that I’m unable to open EDMX files in projects using Entity Framework. I get the following error when I double click on the designer file:



Looking at the machine.config file, I can see there are 2 entries in there for MySQL and sure enough, the invariant names are the same:



<DbProviderFactories>
...
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.0.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.0.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
...
</DbProviderFactories>



The solution - basically instead of uninstalling one of the MySQL Connectors, I just commented one of them out in the machine.config file. Now my EDMX designer works again ;-)

2 comments:

  1. Not the best solution. I found this one: add the following line before the element.

    ReplyDelete
    Replies
    1. Hi Luther, and thanks for your comment. Unfortunately I'm not able to see the line you refer to - perhaps I'm missing something? Certainly keen to know if there's a better solution!

      Delete