Assembly.Load & Petshop conversion.

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi all,

I'm trying to convert Petshop v3 to VB.NET

The following line is supposed to return an instance of a class, where path is
the DLL and className is the class within said DLL.

return (PetShop.IDAL.IAccount) Assembly.Load(path).CreateInstance(className);

For example, if path = "PetShop.SQLServerDAL" and className =
"PetShop.SQLServerDAL.Account", then the code will return an instance of:

PetShop.SQLServerDAL.Account


This works fine, and but in my VB implementation, I'm getting an error from

System.Reflection.Assembly.Load(path)

"Run-time exception thrown : System.IO.FileNotFoundException - File or assembly
name WebAccess.SQLServerDAL, or one of its dependencies, was not found."

I even added those DLL's to the GAC, and still am getting the error.

Any suggestions?
 
Hi Mike,

Do you mean on the same machine, the code line below will work
return (PetShop.IDAL.IAccount)
Assembly.Load(path).CreateInstance(className);

while the code line below will not work
System.Reflection.Assembly.Load(path)

and the path are of the identity value?

This seems to be a fusion failure error you may try to take a look at the
link below to see if this helps you?
Debugging Assembly Loading Failures
http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx

Assembly Binding Log Viewer (Fuslogvw.exe)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/htm
l/cpgrfFusionLogViewerFuslogvwexe.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I figured out the problem. It turns out I was missing a section in my .config
file, which did the trick.
 
Back
Top