Solved

How do I make a DLL in C#?

Posted on 2011-03-08
15
274 Views
Last Modified: 2012-05-11
Hi there;

How do I make a DLL in C#?

Kind regards.
0
Comment
Question by:jazzIIIlove
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +1
15 Comments
 
LVL 13

Assisted Solution

by:Rick
Rick earned 143 total points
ID: 35074190
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 286 total points
ID: 35074220
A DLL is simply the output of a "Class Library" project. When you go into Visual Studio and select File > New Project from the menu, one of the options will be "Class Library". Adding code to a "Class Library" project will create the DLL.

You will also get a DLL from building an Web Application project, but I don't think that is what you mean in this case.
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 35074225
What do you want to achieve? Or, how do you plan to use this DLL?
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 13

Assisted Solution

by:Rick
Rick earned 143 total points
ID: 35074226
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 35074232
what about console app?
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 286 total points
ID: 35074244
A console app will produce an EXE rather than a DLL, as will a WinForms application.
0
 
LVL 13

Expert Comment

by:Rick
ID: 35074249
The 1st example was for a console app.
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 35075131
clarification from my side:
ok, it seems I can create a dll file with C# Classlibrary. ok with that.

What I said above is that may I create dll file from console application/windows form application instead of C# Class library?

Kind regards.
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 35075151
@jazzIIIlove, what's the indeded use for this DLL?  So we can provide the proper answer.
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 35075934
just learning purpose, no intended use yet.

Kind regards.
0
 
LVL 23

Assisted Solution

by:wdosanjos
wdosanjos earned 71 total points
ID: 35076828
I asked about the intended use, because VS provides different project templates that result in DLLs. So, depending on the need you should select the appropriate template.

Class Library
Windows Forms Control Library
WPF User Control Library
WPF Custom Control Library
Office Add-in (Excel, Word, Powerpoint, etc)
etc
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 286 total points
ID: 35080163
You can tell Visual Studio to compile a console project as a DLL if you really wanted to, but Windows won't run it unless it is an EXE.
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 35089254
wdosanjos:
Thanks for the very information.

carl_tawn:
>>A console app will produce an EXE rather than a DLL, as will a WinForms application.
But you can create a dll of a windows form application. Right?

carl_tawn:

>>You can tell Visual Studio to compile a console project as a DLL if you really wanted to, but >>Windows won't run it unless it is an EXE.

but a .NET project can run for it? I ask this to enhance the perception of mine to understand the very scope of a dll.

Kind regards.
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 286 total points
ID: 35092742
A DLL is just a library of classes that can be used by other applications. They cannot run independently they have to be part of an EXE or web application or something else.

There is no point compiling a WinForms application or Console application to a DLL because you will not be able to run it. Visual Studio will let you do it, but that doesn't mean you should.
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 35093256
thanks for the clarification.

Kind regards.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question