Solved

How do I make a DLL in C#?

Posted on 2011-03-08
15
267 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 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now