Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Cannot load file or assembly '…' But... Assembly is NOT referenced anywhere in solution. 1

Status
Not open for further replies.

JCruz063

Programmer
Feb 21, 2003
716
0
0
US
I'm going through a bit of a rough time migrating an ASP.NET 2.0 website from a Windows XP (32-bit) machine to a Windows 7 (64-bit) one. There are lot going on but I'll concentrate on the problem at hand.

The problem:
I'm getting an error that says "Could not load file or assemply 'MySQL.Data, Version 5.2.3.0, Culture...' or one of its dependencies."

The thing is: I'm not referencing MySQL.Data Version 5.2.3.0 ANYWHERE in the solution (or at least not that I could find). I have MySQL 6.6 installed on this computer and I'm referencing that in my web.config file. For the life of me I can't find the file that's making a reference to 5.2.3. I've searched the entire solution for "5.2.3" and it's nowhere to be found. I've gone through my config files and MySQL 5.2.3 is nowhere to be found. I've gone through all my *.cs files as well. No 5.2.3. None. Zip! Nada. Yet, when I try to access a particular code file (which has a using MySql.Data.MySqlClient statement), I get the error above.

The stack trace isn't much help. It shows a C# file as the source of the problem. However, like I said above, there is no trace of 5.2.3 on that file. None whatsoever. So I'm a bit confused as to where the 5.2.3 assembly is being referenced.

The stack trace is below:
Code:
[FileNotFoundException: Could not load file or assembly 'MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.]
   Login.Page_Load(Object sender, EventArgs e) in c:\Jose\KMWebsite2\Login.aspx.cs:42
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

And this too:
Code:
=== Pre-bind state information ===
LOG: User = Computer1\Jose
LOG: DisplayName = MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
 (Fully-specified)
LOG: Appbase = file:///C:/Jose/KMWebsite2/
LOG: Initial PrivatePath = C:\Jose\KMWebsite2\bin
Calling assembly : App_Web_lyss4wgv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Jose\KMWebsite2\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
LOG: Attempting download of new URL file:///C:/Users/Jose/AppData/Local/Temp/Temporary ASP.NET Files/kmwebsite2/49ca7fd8/cb38a83/MySql.Data.DLL.
LOG: Attempting download of new URL file:///C:/Users/Jose/AppData/Local/Temp/Temporary ASP.NET Files/kmwebsite2/49ca7fd8/cb38a83/MySql.Data/MySql.Data.DLL.
LOG: Attempting download of new URL file:///C:/Jose/KMWebsite2/bin/MySql.Data.DLL.
LOG: Attempting download of new URL file:///C:/Jose/KMWebsite2/bin/MySql.Data/MySql.Data.DLL.
LOG: Attempting download of new URL file:///C:/Users/Jose/AppData/Local/Temp/Temporary ASP.NET Files/kmwebsite2/49ca7fd8/cb38a83/MySql.Data.EXE.
LOG: Attempting download of new URL file:///C:/Users/Jose/AppData/Local/Temp/Temporary ASP.NET Files/kmwebsite2/49ca7fd8/cb38a83/MySql.Data/MySql.Data.EXE.
LOG: Attempting download of new URL file:///C:/Jose/KMWebsite2/bin/MySql.Data.EXE.
LOG: Attempting download of new URL file:///C:/Jose/KMWebsite2/bin/MySql.Data/MySql.Data.EXE.

Background and more details:
Like I said above, I'm trying to migrate a site from an XP (32-bit) computer to a Windows 7 (64-bit) one. At first, I simply tried to open the website on the new, Windows 7 computer but that didn't work. Visual Studio 2008 would freeze immediately after opening the solution, and I had to shut it down. So I decided to create the website from scratch and add the different files, folders, and assemblies one at a time, fixing problems as I encountered them.

In the original machine, I do have MySQL 5 installed. However, when switching to the new one, I wanted to move to MySQL 6. The references on the old machine all point to MySQL 5.2.3, so of course there's some kind of invisible reference somewhere which I can't find.

The error happens when I click a Log In button, which points to a page inside a folder that uses Windows Forms authentication. When I click the button, Windows Forms authentication should display the Login.aspx page and that is where the error happens.

The solution contains two projects. One project is the website files (aspx and the like). The other project is class library I created which contains multiple classes related to my business logic, database access and the like. That project has a reference to MySQL and that reference is version 6, not 5. A class from that project is accessed in the Login.aspx.cs file so there might be some connection there. But again, everything points to MySQL version 6, so I don't understand why/how/where the reference to version 5.

My System:
On the new machine:
[ul]
[li]Windows 7 (64-bit) SP1[/li]
[li]Visual Studio 2008 Website[/li]
[li]Website runs from the file system using built-in[/li]
[li]Visual Studio Web Server Website is ASP.NET 2.0 (tried to create using 4.0 but gave up)[/li]
[li]MySQL 6[/li]
[li]Crystal Reports and other stuff which cause lots and lots of problems[/li]
[/ul]

On the old machine
[ul]
[li]Windows XP[/li]
[li]Visual Studio 2008[/li]
[li]Website runs from IIS[/li]
[li]Website is ASP.NET 2.0[/li]
[li]MySQL 5[/li]
[li]Crystal Reports and lots of other stuff which works smoothly[/li]
[/ul]

_________________________________
I think, therefore I am. [Rene Descartes]
 


I'd try checking the bin folders and remove any MySQL dlls. Then clean the solution and Rebuild...




Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Thanks Mark.

MySQL isn't in the Bin folder, but it is in the web.config as I added a reference to it. Also, there's a reference to MySQL in the References folder of the second project (the class library) in the solution. I removed them both, cleaned the solution, added them back, and rebuilt and I still get the same problem.

Also, I noticed the following in the statck trace:
Code:
Calling assembly : App_Web_lyss4wgv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.

I wonder if that has anything to do with it.

Anyone knows where that MySQL 5.2.3.0 reference might be coming from? Is there some hidden file I could edit or delete?

Thanks




_________________________________
I think, therefore I am. [Rene Descartes]
 


Try this, close the solution and open the .proj files in notebook or some other text editor and see if there is a reference in there that is 'hidden' while in the IDE. It has to be loading from somewhere...



Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
I tried that already to no avail. There is no reference to 5.2 anywhere. I also did a binding redirect and added a DbProviderFactory to the web.config file. This is maddening.

_________________________________
I think, therefore I am. [Rene Descartes]
 

The last thing I can recommend is to see if the reference was put in the default web.config or machine.config in the framework. Look in C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG for both config files.


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Thanks again Mark...
I had previously checked machine.config as it is listed on the stack trace but again, nothing. I'm not sure what else to do.

Right now I just finished creating a brand new Login file from scratch. I copied the old *.aspx and *.cs from the old file (neither of which contains any mentions of MySQL 5.2.3, of course) and removed the old Login.asxpx and *.cs and ran it hoping it would work. It didn't. And now the stack trace points to the brand new Login2.aspx.cs as the cause of the problem. Can you believe that!!!! This is so frustrating!

_________________________________
I think, therefore I am. [Rene Descartes]
 


Take a look here. Sounds a lot like your issue.





Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Thanks Mark... That is exactly my problem, word for word. Except the assembly I'm having issues with is MySql.Data while the one in the post is one from Telerik.

I went through all the solutions offered in the post and still could not get things to work, however. I decided to Microsoft support a call. I'll post back after I speak to them.

Thanks for all your help.


_________________________________
I think, therefore I am. [Rene Descartes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top