Loading a C#dll into a C# exe
I am new to C# can any please tell how开发者_如何学Go to load a dll created in C# to a exe in c#
I have .NetFrameWork 3.5 and my o.s Vista
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
If you add a reference to the DLL in your project it will be loaded the first time it is needed.
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.
精彩评论