Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should I add a project to my solution vs. adding the project's dll to my solution

So right now I have project A and project B. Then there is a class library project Z. Project Z contains classes and methods both A and B use.

My question is, should I have project Z compiled and added to project A and B using its dll, or adding the project itself to both A and B?

Which cases would I use project in project in appose to dll in project?

like image 224
James Avatar asked Mar 02 '11 19:03

James


3 Answers

If code from project Z is built and released on the same schedule as projects A and B, Z should probably be a part of the same solution.

On the other hand, if Z is a fairly stable library, with it's own release/maintenance schedule, you'll probably want to add it as a compiled reference.

You can ask yourself simple questions such as must Z to be compiled every time A and B are compiled? Should a developer working on A and B be able to modify Z?

like image 143
madd0 Avatar answered Oct 15 '22 19:10

madd0


In my experience, the biggest differentiation between doing one or the other is the amount of transparency you need within the specific project.

Obviously, if you have the potential to edit the project in any way, you would need direct access to the project. But on the other hand, if you are debugging an issue and you reach a project for which you only have the dll, your code vanishes into the black box of that dll and coughs out the result, disallowing you to step through it.

In the end, it is typically a preference thing. If you are confident enough that you won't need to get inside the black box of a dll while debugging or error hunting, and you would like a cleaner solution explorer, then by all means simply include it as a dll. This also allows for a faster compile time as it doesn't have to compile that particular project into a dll for debugging/release/etc. If you don't mind the extra clutter (and longer build times), or need that transparency, then I would suggest including it as a project.

As for my personal preference, I tend to not mind the longer build time and more cluttered solution explorer, and prefer adding projects instead of dlls when that is an option.

like image 25
guildsbounty Avatar answered Oct 15 '22 18:10

guildsbounty


I think if Z is used both by A and B (assuming A and B are in different solutions), then you should add Z as dll. This way you will edit code in one place instead of two and you are sure that A and B are using the same version of Z library (again assumin you update dll in both ;))

like image 43
Adrian Serafin Avatar answered Oct 15 '22 19:10

Adrian Serafin