Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
I have few .CS files in my project like Item.cs,Stock.cs,Supplier.cs.
How can I create a Assembly from those .cs files.

[edit] corrected Assebly to Assembly[/edit]
Posted
Updated 22-Mar-11 18:07pm
v2

You could not effectively program these file without compiling them. If you compile them in some project, the result if it is always an Assembly. Always, not exclusions. It does not matter if it is *.DLL or *.EXE. For .NET, the difference is insignificant. Both can be used a a library (for many developers it will be a surprise!), but *.EXE can also be run from the Shell. Also, extension can be anything; *.EXE file is recognized not really by extension, but by the entry point.

The rest depends on what are you using. If you use Visual Studio, you create an empty project and adds those files to it, using "Add existing item". You don't have to. You can use the bare compiler. See compiler documentation for more detail.

—SA
 
Share this answer
 
v2
Hi Sanjeev,

You can create a assembly without adding these files into a project.
Just do one thing, add all the classes into a Namespace.
and complie them from command prompt e.g.

csc /out:<filename> /t:library <file1> <file2>

/t:library - DLL
/t:exe - EXE

Regards
Ankit
 
Share this answer
 
You convert your project output type to class library.

Best Regard,
Theingi Win
 
Share this answer
 
Comments
Sanyon_d 23-Mar-11 0:28am    
Thanks for the solution. When convert project output type to a class library what's change I need to do in program.cs.
After compiling the project and I added that reference to another project. But it doesn't show any method from the reference.
Theingi Win 23-Mar-11 1:36am    
Your check your method is may be private , if true you change public your method and then compile and try again.

Thanks For Reply sanjeewabdissa,
Theingi Win

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