Matt Schubert
Matt Schubert

Reputation: 1003

VB.Net dll referenced in C# project

I have a previously created project written in VB.Net. I have a website that is written in C# referencing the VB project. The VB project is a class that accesses the database. It compiles and runs fine on my local machine. When I put it on the server, I get the following error

Cannot load type 'DLLOM.clsDB, DLLOM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

This is the code it is failing on

DLLOM.clsDB objDB = (DLLOM.clsDB)Activator.GetObject(typeof(DLLOM.clsDB), ConfigurationManager.AppSettings["RemotingPathDB." + System.Environment.MachineName.ToUpper()]);
DataSet ds = objDB.MembershipsGet();

Any idea on why it is correctly referenced on my machine, but not on the server? The website is compiled on 3.5 framework, while the VB class is 2.0. I tried switching them to no avail.

Upvotes: 0

Views: 181

Answers (1)

Hans Passant
Hans Passant

Reputation: 941218

Cannot load type 'DLLOM.clsDB, DLLOM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

It is a TypeLoadException. That's the boring part, it doesn't get interesting until you start looking at the InnerException. Which tells you what really happened to stop the type from getting loaded.

If this is all you got out of your program then you need to improve your exception reporting. Be sure to use the exception's ToString() method instead of the Message property. You'll get everything, including the inner exceptions. If you get it in the debugger then be sure to use the Exception Assistant.

Upvotes: 1

Related Questions