locked
Visual Studio can't load MySql.Data.EntityFramework RRS feed

  • Question

  • User1457298193 posted

    I'm trying to synchronize an old .net application with Visual Studio 2019. However, I'm getting the error below when I try to open the ADO.NET

    Severity	Code	Description	Project	File	Line	Suppression State
    Error		Error 4: Could not load file or assembly 'MySql.Data.EntityFramework, Version=8.0.21.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)	iRentFeedData	C:\Users\giova\OneDrive\Documents\Visual Studio 2019\Projects\ProName\ProdName\Models\myModel.edmx	7	

    I have MySQL Connector Net 8.0.21 installed. Also, I have MySql.Data version: 8.0.21.0 and MySql.Data.EntityFramework version: 8.0.21.0

    Here is my webconfig:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=301879
      -->
    <configuration>
      <configSections>
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
      <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --><sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
    			<section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
    			<section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
    		<section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" /><section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" /></sectionGroup><!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
      <appSettings></appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5.2" />
        <httpRuntime targetFramework="4.5.2" />
      </system.web>
      
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
          </dependentAssembly>
        </assemblyBinding>
      <!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). --><!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). --><legacyHMACWarning enabled="0" /><!-- When targeting ASP.NET MVC 3, this assemblyBinding makes MVC 1 and 2 references relink
    		     to MVC 3 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it.
    		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    			<dependentAssembly>
    				<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    				<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
    			</dependentAssembly>
    		</assemblyBinding>
    		 --></runtime>
      <connectionStrings>
        <add name="myEntities" connectionString="metadata=res://*/Models.myModel.csdl|res://*/Models.myModel.ssdl|res://*/Models.myModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=vps.myserver.com;user id=myUser;password=myPass;database=mydb&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        
      <providers>
          <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
          </provider>
        </providers></entityFramework>
    <system.webServer>
        <handlers>
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <remove name="OPTIONSVerbHandler" />
          <remove name="TRACEVerbHandler" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>
      <httpProtocol>
        <customHeaders>
          <add name="Access-Control-Allow-Origin" value="*" />
          <add name="Access-Control-Allow-Headers" value="Content-Type" />
          <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
        </customHeaders>
      </httpProtocol>
      </system.webServer>
      <system.net>
    		<defaultProxy enabled="true" />
    		<settings>
    			<!-- This setting causes .NET to check certificate revocation lists (CRL) 
    			     before trusting HTTPS certificates.  But this setting tends to not 
    			     be allowed in shared hosting environments. -->
    			<!--<servicePointManager checkCertificateRevocationList="true"/>-->
    		<!-- This setting causes .NET to check certificate revocation lists (CRL) 
    			     before trusting HTTPS certificates.  But this setting tends to not 
    			     be allowed in shared hosting environments. --><!--<servicePointManager checkCertificateRevocationList="true"/>--></settings>
    	</system.net><dotNetOpenAuth>
    		<messaging>
    			<untrustedWebRequest>
    				<whitelistHosts>
    					<!-- Uncomment to enable communication with localhost (should generally not activate in production!) -->
    					<!--<add name="localhost" />-->
    				</whitelistHosts>
    			</untrustedWebRequest>
    		</messaging>
    		<!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
    		<reporting enabled="true" />
    	<!-- This is an optional configuration section where aspects of dotnetopenauth can be customized. --><!-- For a complete set of configuration options see http://www.dotnetopenauth.net/developers/code-snippets/configuration-options/ --><openid>
    		<relyingParty>
    				<security requireSsl="false">
    					<!-- Uncomment the trustedProviders tag if your relying party should only accept positive assertions from a closed set of OpenID Providers. -->
    					<!--<trustedProviders rejectAssertionsFromUntrustedProviders="true">
    						<add endpoint="https://www.google.com/accounts/o8/ud" />
    					</trustedProviders>-->
    				</security>
    				<behaviors>
    					<!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
    					     with OPs that use Attribute Exchange (in various formats). -->
    					<add type="DotNetOpenAuth.OpenId.RelyingParty.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth.OpenId.RelyingParty" />
    				</behaviors>
    			</relyingParty></openid></dotNetOpenAuth><uri>
    		<!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
    		     which is necessary for OpenID urls with unicode characters in the domain/host name.
    		     It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
    		<idn enabled="All" />
    		<iriParsing enabled="true" />
    	</uri></configuration>

    I already reinstall the MySql.Data.EntityFramework, but it did not solve the issue. Any idea of waht is happening?

    Thank you!


      

     

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thursday, August 27, 2020 2:39 PM

All replies

  • User-939850651 posted

    Hi perazzo,

    I regret that I don't have enough environment to test your problem. I did some search for your problem. The reason for similar cases may be that the referenced assembly version is inconsistent.

    Could you provide more detailed error information? This can help us find the cause of your problem more easily.

    More details, please refer to MySql Entity Framework Support

    Best regards,

    Xudong Peng

    Friday, August 28, 2020 3:49 AM