简体   繁体   中英

How to compile cs files into separate dll

I have a class library and cs files which are for different objectives. One is extension class, the other is windows form control the other is asp.net control, etc.

I want to compile all these cs files into a different dll.

PS: Some of them will need more than one class files maybe.

I know this sounds too obvious, but if you want to compile them into seperate DLLs, why don't you create a project per assembly? So that's a project for the extension classes, one for the asp.net controls etc...

You may try command line compilation . ( Working with the C# 2.0 Command Line Compiler )

csc /target:library /out:Something.xyz *.cs

You have to create different projects in your solution (assuming you work in Visual Studio).

Each project can have multiple (class, resource, form, etc.) files and will be compiled into different assemblies (dll's). For each project you can specify settings (assembly name, target framework, etc.).

Classes from different projects can "use" each other by making references from one project to the other. Also, different projects can specify the same namespaces so that you can structure the aplication to your own wishes.

See Structuring Solutions And Projects

All *.cs in a single class library project will compile into the same DLL, you can not split them into individual dlls. If you want a seperate dlls for each class then each should be in a seperate class library project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM