views:

442

answers:

3

Hi Members

I am new to C# can any please tell how to load a dll created in C# to a exe in c#

I have .NetFrameWork 3.5 and my o.s Vista

+1  A: 

If you add a reference to the DLL in your project it will be loaded the first time it is needed.

Jan Bannister
+2  A: 

Here's a result from a quick google on what I assume is your actual question: How to: Add or Remove References in Visual Studio. There are some slight differences between Visual Basic and C# but the article and any links explain it all.

Basically, create a reference to the dll in your project file in Visual Studio, add the appropriate using statement to the namespace desired, and reference any class you like from the dll.

If you're not using Visual Studio and project files, the above link will help you build from commandline. E.g., csc /out:TestCode.exe /reference:MathLibrary.DLL TestCode.cs

If it's not what you're looking for, try this: Dynamic load .NET dll files (Creating a plug-in system) – C#. Here is a much more elaborate model: Plugin architecture using C#

Oh, also, since you're new to C#, this might be of use to you in general: Visual C# Developer Center - New to development

J. Steen
A: 

Add a reference and include the relevant namespace(s).

.NET doesn't support static linking of libraries, so your reference assemblies will be loaded at runtime as needed.

Brian Rasmussen