Failed to generate code. Could not load file or assembly 'MySql.Data, Version=6.6.5.0 - mysql

I'm getting the following error on all of my website's pages:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Failed to generate code. Could not load file or assembly 'MySql.Data, Version=6.6.5.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)
Source Error:
Line 1: <?xml version="1.0" encoding="utf-8"?>
Line 2: <xs:schema id="newsarticles" targetNamespace="http://tempuri.org/news.xsd" xmlns:mstns="http://tempuri.org/news.xsd" xmlns="http://tempuri.org/news.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
Line 3: <xs:annotation>
Source File: /App_Code/news.xsd Line: 1
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
I checked the assemblies in my web.config, but no references to MySQL are there:
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<clear />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies>
</compilation>
I then checked the references of my website project. There I noticed a lot of different MySQL versions are referenced. I tried to delete all references but version 6.7.4.0, however, I can't even delete the references (see screenshot).
I have these files in my bin folder, both of version 6.7.4.0:
MySql.Data.dll and MySql.Data.Entity.dll
How to fix this error?

try to add this to your web.config:
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description="Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
</DbProviderFactories>
</system.data>
Also, you don't need to reference any dlls from GAC. Just use nuget packages (MySQL.Data, MySQL.Web)

Related

How to resolve this: "NuGet Package restore failed for project VTS: Unable to find version '10.0.0.0' of package 'Microsoft.ReportViewer.Common'"?

I am using VS 2013 for a webform project. But when adding a rdlc report I am getting the below message
"NuGet Package restore failed for project VTS: Unable to find version
'10.0.0.0' of package 'Microsoft.ReportViewer.Common'.."
I tried every possible way to dowload version 10.0.0.0; Unfortunately I failed every time. I have installed reportviewer2010 &reportviewer 2015 runtime.
In .aspx page I added this:
<%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
and in webconfig file
<!--<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</assemblies>-->
Nuget package has no dll with Microsoft.ReportViewer.Common 10.0.0.0; There is only one version available i.e Microsoft.ReportViewer.Common 10.0.40219.1;

SSRS Web Application Error. Having version issues

Here is what I have and I'm sure it is versioning but I can't seem to figure it out.
Visual Studio 2019
Framework : 4.7.2
This was Framework 3.5 and I upgraded to version 4.7.2. It was working until I open a report to edit and then it wants to edit the Report (RDLC).
Error1: Severity Code Description Project File Line Suppression State
Error The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' D:\Development\Work\asedra\Website\Reports\RptViolation.aspx 44
Error 2 : ASP.NET session has expired
Web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</buildProviders>
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.ReportViewer.DataVisualization, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</assemblies>
rdlc
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
the web page (.aspx)
<%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>[![enter image description here][1]][1]
Error1: Register ReportViewer on .aspx like this
<%# Register assembly="Microsoft.ReportViewer.WebForms" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
Add to web.config this line
<system.webServer>
<handlers>
<add name="ReportHandler" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
Error2: Store session state on SQL server. Here's a guide: HOW TO: Configure SQL Server to Store ASP.NET Session State.
Basically, you need to create ASPState database, activate ASP.NET State Service and add this line to the web.config:
<sessionState
mode="SQLServer"
sqlConnectionString="data source=127.0.0.1;user id=<username>;password=<strongpassword>"
cookieless="false"
timeout="20"
/>

CRM 2011 UR 18 Issue - Cannot Render Report

Getting this error (in the Application EventLog) when trying to display a particular report:
Exception message: The base class includes the field 'reportViewer', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).
We have this in web.config for CRM:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
...
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
We're seeing an error on some machines, but not others.
This CRM machine has the Microsoft Report Viewer 2010 Redistributable Package installed. As I noted in the title, we have CRM 2011, UR 18.
Is there a different version of Report View that we need to install here?
We were able to resolve this issue. We had to install the Microsoft Report Viewer 2012 Runtime onto the CRM web server, https://www.microsoft.com/en-us/download/details.aspx?id=35747.
Microsoft had modified the PublicKeyToken for v2012 (which is version 11.0.0.0), so the resulting web.config edit also was more than just a version change.
The resulting, correct, CRMWeb web.config (for CRM 2011) is:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
</httpHandlers>
<compilation defaultLanguage="C#" debug="false">
<assemblies>
<add assembly="Microsoft.Crm, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Crm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Crm.Platform.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>

Could not load file or assembly 'MySql.Data, Version=6.8.3.0" or one of its dependencies. The system cannot find the file specified

I keep getting this Config error everytime I try and upload my website to the server, works fine on localhost
Could not load file or assembly 'MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Line 18: <compilation strict="false" explicit="true" targetFramework="4.0" debug="true">
Line 19: <assemblies>
Line 20: <add assembly="MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
Line 21: <add assembly="MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
Line 22: </assemblies>
I have tried copying the dll's to bin but that didn't work, i've deleted the references and readded in VS2013, rebuilt the project, access the GAC and copied from there...but none of that has worked. Anyone got any suggestions as to what to try next, code from web config is below.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.7.0" newVersion="6.8.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<customErrors mode="Off"/>
<compilation strict="false" explicit="true" targetFramework="4.0" debug="true">
<assemblies>
<add assembly="MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
</compilation>
<httpRuntime/>
</system.web>
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="MainConnectionString" connectionString="Server=xxxxxxx;Initial Catalog=Main;Persist Security Info=True;UID=xxxxx;Password=xxxxxxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
Not sure if it will help you but I just had a similar problem.
After right clicking in the solution Explorer on the mysql.data.dll and select "include in project" it Works on my webserver... (After republishing of course)
Be sure to have MySql.Data.dll deployed in your project's bind folder or in the web server's GAC.

The type or namespace name 'Linq' does not exist in the namespace 'System.Data' , etc

I just made a Linq-to-SQL .dbml file in Visual Studio 2010.
I'm getting the following 2 errors, a total of 60 times in total, mostly the first.
The type or namespace name 'Linq'
does not exist in the namespace 'System.Data'
The type or namespace
name 'EntitySet' could not be found
I've found various similar questions here and on other sites, all of which seem to say that some extra assembly needs to be added.
I've added every one suggested, the problem persists. Another odd thing is that VS2010 itself doesn't underline the errors in the editor screen, but it does show them in the error log.
Anyways, I've seen all the existing topics and applied their solutions, the problem persists.
Some technical details:
I'm running Windows 7 32-bit.
I still have Visual Studio 2008 SP1
installed. I just installed VS2010
when it came out and didn't remove
the older one.
I'm running MSSQL server 2008 R2.
And here's the assemblies listed in my web.config file:
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Services.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.SqlXml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
I found this link which solved it for me. The net is that the following must be added to web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</assemblies>
</compilation>
</system.web>
</configuration>
Note that the configuration/system.web/compilation tags are already there, and the assemblies/add assembly tags need to be added. This even though System.Data.Linq is readily found by VS when building.
The failure was in App_Code.LinqToObservations.designer.cs, code that's generated by Linq from my LinqToObservations.dbml file.
(Additional background: I likely got into this situation because I enabled Linq after the fact using the procedure found here.)
I've been having the same problem on exactly the same config except for my Windows 7 is 64-bit. Got it solved by doing [project name] -> References -> Add reference -> System.Data.Linq Why do you add references by hand?
Important, you must set in webconfig
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
You can try following:
Add reference to System.Data.Linq (Right click on References folder | Select Add Reference | Select .Net tab(Is default selected) | select System.Data.Linq reference | click OK.
I hope this will help you or someone else.