Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Hewitt 65 posts 126 karma points
    May 04, 2016 @ 09:02
    Simon Hewitt
    0

    MySQL Data Provider version issue

    When I try to install the MySQL provider on a copy of Umbraco 7.4.2 I get an error telling me the package contains incompatible dlls.

    The error I get is;

    An error occurred while loading a referenced assembly 'MySql.Data' see error log for full details.

    I installed it anyway and when I try to connect to the database I get;

    Error validating the Data source: Could not load file or assembly 'MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    I have a copy of MySql.Data.dll in the solution but obviously its the wrong one, what do I need to do to resolve this issue?

  • Richard Soeteman 3970 posts 12472 karma points MVP
    May 04, 2016 @ 09:10
    Richard Soeteman
    1

    Hi Simon,

    This dll comes from .net 4.5. Maybe you can use that .net version for the site?

    Hope this helps,

    Richard

  • Simon Hewitt 65 posts 126 karma points
    May 05, 2016 @ 09:47
    Simon Hewitt
    0

    Hi Richard,

    Many thanks for the fast reply, I was pulled away with another project yesterday so I haven't had time to look into this one yet.

    The Solution is a large project we had written under Umbraco 4 which we are now re-writing to use the features in version 7. It is all compiled under .net 4.6.1 and when I change the target framework I get a lot of warnings about nuget packages and inconsistent versioning. We have installed MySQL for other parts of the project via the nuget package which uses the 6.9.8 version and we have code relying on that reference.

    I'm not sure where that leaves me, or if it's possible to run the site on .net 4.5 even though I'm compiling against a higher framework (sounds like a bad idea to me). And even if I do won't the reference I have to the newer version still be an issue.

    I realise this has veered away from being a CMS Import issue and more into my config but any help you can offer would be appreciated as I would really like to use your tool for migrating content across our installs.

    Many thanks Simon

  • Sebastiaan Janssen 4993 posts 15138 karma points MVP admin hq
    May 05, 2016 @ 11:28
    Sebastiaan Janssen
    102

    Simon, in your web.config find the DbProviderFactories and make sure the MySql one looks like this, with no version number:

    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
    

    And it might be necessary (but I don't think so) to add an assembly redict in the runtime section, something like:

     <dependentAssembly>
       <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
       <bindingRedirect oldVersion="0.0.0.0" newVersion="6.9.8.0" />
     </dependentAssembly>
    
  • Richard Soeteman 3970 posts 12472 karma points MVP
    May 06, 2016 @ 05:14
    Richard Soeteman
    1

    Great suggestion Sebas, does that work for you Simon?

  • Simon Hewitt 65 posts 126 karma points
    May 06, 2016 @ 10:51
    Simon Hewitt
    0

    Yes this has worked a treat, I did need the assembly redirect as well but thank you both for your time!

Please Sign in or register to post replies

Write your reply to:

Draft