Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I make a DLL in C#?

Posted on 2011-03-08
15
Medium Priority
?
277 Views
Last Modified: 2012-05-11
Hi there;

How do I make a DLL in C#?

Kind regards.
0
Comment
Question by:jazzIIIlove
  • 5
  • 4
  • 3
  • +1
15 Comments
 
LVL 13

Assisted Solution

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

Assisted Solution

by:Carl Tawn
Carl Tawn earned 1144 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 13

Assisted Solution

by:Rick
Rick earned 572 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 1144 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 284 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 1144 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 1144 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

972 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