Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
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
Updated 5-Sep-12 1:09am
v2
Comments
[no name] 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?
sahabiswarup 5-Sep-12 7:22am    
i have never used command line..so that i didn't get this..

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
 
Share this answer
 
v2
Comments
sahabiswarup 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..
bbirajdar 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 5-Sep-12 7:49am    
good answer. +5.
sahabiswarup 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
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.
 
Share this answer
 
Comments
[no name] 5-Sep-12 8:04am    
Good answer.
+5!
sahabiswarup 5-Sep-12 8:10am    
Thanks all for your co-operation..
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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900