subbu
subbu

Reputation: 3289

Loading a C#dll into a C# exe

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

Upvotes: 2

Views: 849

Answers (3)

J. Steen
J. Steen

Reputation: 15578

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

Upvotes: 2

Brian Rasmussen
Brian Rasmussen

Reputation: 116401

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.

Upvotes: 0

Jan Bannister
Jan Bannister

Reputation: 4999

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

Upvotes: 1

Related Questions