Say I have a large project contain开发者_如何学运维ing the types A
through Z
.
What if, for whatever reason, I want to package and distribute just type A
to some client(s)?
Obviously I cannot just compile A
into its own DLL unconditionally; it may depend on some other types in my project. But it's unlikely it depends on every type in my project.
What I'm envisioning is some tool that could examine A
, identify its dependencies, and somehow compile a minimal DLL with only the types required for the type I want (A
) and no more.
So for example if A
depends on functionality provided by B
and C
, and B
depends on D
, but C
and D
have no additional dependencies (aside from possibly A
, B
, or each other), this tool would take A
through D
and compile just those types into a DLL for me to do with as I see fit.
Is such functionality available through Visual Studio? If not, is there some add-in or external tool capable of doing this? Incidentally, is what I'm asking about even reasonable, or do you feel that something like this would be a bad idea?
Obviously I could always do this manually; it just seems like that would be a lot of work (and if it's a bad idea to begin with, well, then just forget it).
This sounds like an ideal problem for a make file. I don't know how the .NET bit will play into it but for the classic C model you could do something like this:
clean :
del *.obj
libA.lib : A.obj
makelib *.obj
libB.lib : B.obj
makelib *.obj
...
A.obj : B.obj C.obj
compile A.cs
B.obj : C.obj D.obj
compile B.cs
C.obj :
compile C.cs
D.obj :
compile D.cs
...
Run make clean A
and you should get everything you need for A and nothing more.
精彩评论