The problem is as follows: Where is the mistake

This problem occurs at the stage of adding an EDM model. Immediately after forming a connectionString

Preparatory work (references, plug-ins, all affairs) conducted according to instructions from the answer to this post: https://stackoverflow.com/questions/22031269/enable-entity-framework-6-for-mysql-c-in-winforms-of -microsoft-visual-studio Issued this error. Then I updated everything related to MySQL (including the connector and the plugin) to the new versions with a full MySQL installer. Then he took down the entire App.Config, Packages.config, all the Reference and added the reference in a new way in the same order (the mentioned files were overwritten).

After all these frauds, the error remained. The only thing I didn’t do was do point 9, since there was no MySQL Connector Net 6.8.3 folder in the ProgramFile MySQL folder (although it was in ProgramFile (x86).


App.config


<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <!--<entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework>--> <entityFramework> <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> </providers> </entityFramework> <system.data> <DbProviderFactories> <remove invariant="MySql.Data.MySqlClient" /> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.9.8.0" newVersion="6.9.8.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 

packages.config


 <?xml version="1.0" encoding="utf-8"?> <packages> <package id="EntityFramework" version="6.1.3" targetFramework="net45" /> <package id="MySql.Data" version="6.9.8" targetFramework="net45" /> <package id="MySql.Data.Entities" version="6.8.3.0" targetFramework="net45" /> <package id="MySql.Web" version="6.9.8" targetFramework="net45" /> </packages> 

    1 answer 1

    In general, I figured it out. My solution consists, in fact, of three separate projects: three class libraries (one is connected with the BD and the entire work with it is registered, the other is shared, the third is the interface).

    So, all references, all the UpConfig needed to be duplicated to the third library too, since it is executable (I used to push them all only into the library to work with the database)

    • one
      I'll tell you more, app.config only makes sense for projects that are launched. - Pavel Mayorov
    • Wow, I will know. It seems like the problem was solved then, I did some work with the database, then I decided to change it. After the changes, I tried to update the model and failed (the model wizard simply closed by clicking on "Next" after forming the connectionString). I began to perform the same actions as before, but it did not help. Then I got into the project packages and saw that I had a lot of trash installed there. I demolished everything (and references with app config and pekedzhe too), but when starting the project, NuGet restored EntityFramework 6.1.3. Why is this happening, do not tell? Maybe the reference can not see? - Andrey
    • NuGet can automatically recover packages from the packages.config file. Where did you remove them from? - Pavel Mayorov
    • But at the same time, even after adding all the libraries mentioned in the post, the link to which I gave in the question, the model master writes that he could not find a database provider. Suggests to choose 5.0. and in NuGet writes that EntityFrameworks is already installed (version 6.1.3.). Although I don’t see it in the references - Andrey
    • Removed both from app.config and from packages.config, this is odd - Andrey