Solved

How do I make a DLL in C#?

Posted on 2011-03-08
15
273 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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