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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a library...

Status
Not open for further replies.

SigmaX2

Technical User
Aug 14, 2005
9
US
Hey;

I'm fairly new to C#, and am trying to make a program that's split up into a .exe and a .dll file. I thought I had it all figured out, and it compiles perfectly with MCS (An open-source C# complier that I've been using). It runs perfectly with Mono, but when I try to run it on .NET, I get:

Code:
Unhandled Exception:  System.TypeLoadException: Could not load type CDurry.coredurry from assembly cdurry, Verion-0.1.0.0, Culture=neutral, PublicKeyToken=null.

    at consdurry.Main()

CDurry is the namespace in my dll and coredurry is the class I'm referencing.

Basically I want to know how I'm supposed to reference functions in a dll, and see if I'm doing it right.
Thanx for any assistance,
SigmaX
 
I think you're thinking to hard about this. Once a project has a reference to another DLL, you can creates classes and invoke methods from the referenced dll as easily as if they were in the current project....

All my references are controled by VS.NET, they look like this in the csproj file:

<Reference
Name = "MyDll"
AssemblyName = "MyDll"
HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Web.dll"
/>

Once you have the references setup, you just declare a class in the normal way, but qualify it with the namespace:

MyDll.MyClass x = new MyDll.MyClass();


 
Well I must still be doing something wrong. My DLL has a namespace (CDurry) and a couple classes. In my exe I have CDurry.dll referenced properly, and a "using CDurry;" at the top of the file.

Under Main(); I have:

Code:
CDurry.coredurry core = new  CDurry.coredurry();
CDurry.conecdurry conec = new  CDurry.conecdurry();

Any clues as to why it's giving me grief?
Thanx,
SigmaX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top