views:

31

answers:

2

I have a class library with a bunch of classes and I would like to compile each of my classes into its own assembly. Is that possible?

+3  A: 

It is possible. A separate assembly is created when you compile your solution for each project that exists in Visual Studio, so you only need to create a project per class to obtain what you want.

Having said that, I am not sure that having one assembly per class is a good thing to do. Loading assemblies at run-time is expensive, and managing them at design-time requires some effort too. Would you care to elaborate on why you need such a thing?

CesarGon
I would like, in a single project, to compile each class into its own assembly, and not into one assembly. I don't want to create a seperate project for each class, but just have one project with multiple classes where it will produce assemblies.
Brandon Michael Hunter
The answer is simply no, then. What you want to do is not possible. Maybe the resulting single assembly can be later split into multiple assemblies using third-party tools.
CesarGon
Is there a way to write a bat file to do this on post-build?
Brandon Michael Hunter
The problem is not the bat file, but finding the third-party tool that would split an assembly into multiple ones.
CesarGon
+1  A: 

I would have to guess your real question is "can it be done automatically?" No, you have to create a project for each assembly. Quite a maintenance and deployment nightmare with no easily conceivable advantages.

Hans Passant