Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Visual-Studio DLL
I have googled this thing and found lots of solution;
I have already used class so have idea about that..now i want to use my own DLL.
After creating the class everyone suggest me to do the following
 
Go to the command line and type the following.
 
CSC /target:library /out:MyFunctions.dll AddClass.cs
MultiClass.cs FactorialClass.cs
 
Go to the command line option /target:library and ask the C Sharp Compiler/Linker to output a DLL instead of an EXE. It's possible to have a different name for the DLL; for example, /out:MyFunctions.dll directs the compiler to output the DLL with the name MyFunctionsLib; otherwise, it will take the default name from the first .cs file. Here, it's AddClass.dll.
 
I am not getting this above thing..can anyone please help me understand this thing.
Thanks in advance.
Posted 5-Sep-12 1:02am
Edited 5-Sep-12 1:09am
v2
Comments
Wes Aday at 5-Sep-12 7:14am
   
Understand what "thing"? Why are you even using the command line? What aren't you creating a project in the IDE?
biswarup88 at 5-Sep-12 7:22am
   
i have never used command line..so that i didn't get this..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello ,
 
To build the file MyFunctions.DLL, compile the two files Add.cs and Mult.cs using the following command line:
csc /target:library /out:MyFunctions.DLL Add.cs Mult.cs
The /target:library compiler option tells the compiler to output a DLL instead of an EXE file. The /out compiler option followed by a file name is used to specify the DLL file name. Otherwise, the compiler uses the first file (Add.cs) as the name of the DLL.
 
To build the executable file, TestCode.exe, use the following command line:
csc /out:TestCode.exe /reference:MyFunctions.DLL TestCode.cs
The /out compiler option tells the compiler to output an EXE file and specifies the name of the output file (TestCode.exe). This compiler option is optional. The /reference compiler option specifies the DLL file or files that this program uses.
 
Please refer URL (http://msdn.microsoft.com/en-us/library/3707x96z(v=vs.80).aspx[^]) for more details
  Permalink  
v2
Comments
biswarup88 at 5-Sep-12 7:26am
   
I have found this above content after googled this topic .. i want to know how to build dll using command line..
aspnet_regiis at 5-Sep-12 7:36am
   
Did you read the solution 1? prashant is telling you in details the method to build a dll with 'command line' itself.... not the IDE.....
Rahul Rajat Singh at 5-Sep-12 7:49am
   
good answer. +5.
biswarup88 at 5-Sep-12 8:12am
   
aspnet_regiis can you please tell me in details how to compile the two files Add.cs and Mult.cs using command line? That i can't understand...though the problem is solved using solution3..but i want to know solution1
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

If you are using Visual Studio you can do by following steps:
1. Open your project.
2. Go to your solution explorer.
3. Right click on your project name and select properties tab.
4. Go to Application tab and find 'output type' option.
5. Click on output type and select class library.
6. Save and Close properties window.
7. Build your project you will find dll files in debug folder of your project.
8. Now you can coopy your dll to and project or include them in any project you want.
  Permalink  
Comments
biswarup88 at 5-Sep-12 8:10am
   
Thanks all for your co-operation..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Prashant has given the solution to do it from command line. I still don't understand why would you not use the IDE. In case you want to use the IDE to do the same refer to the following solution:
 
http://www.c-sharpcorner.com/UploadFile/mahesh/dll12222005064058AM/dll.aspx[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 513
1 CPallini 350
2 George Jonsson 321
3 Prasad Avunoori 178
4 Prasad Khandekar 135
0 OriginalGriff 4,623
1 CPallini 3,410
2 Sergey Alexandrovich Kryukov 2,929
3 George Jonsson 2,319
4 Gihan Liyanage 2,077


Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100