I've always taught myself and others to think of the bin folder as being transient.
That is you should be able to delete it and next time you rebuild it gets recreated and any references get copied into it without any hassle And not to put your eggs all in one basket. Or in this case don't put all your required dlls directly into the bin folder. Have them elsewhere and just reference them.
I've seen people falling down when they put dlls directly into the bin folder and reference them there. So I try to avoid this and put all my required dlls in a folder called Refs and add references to the dlls in there. At compile time they will get copied into the bin folder anyway.
Am I insane? Is this being too careful? common sense?
What is best practice in this scenario?
Cheers,
-- Lee
UPDATE : Turns out i'm not mad
Cheers guys you've picked up on some points I forgot to mention.
Mainly :
That's right, you don't want to put referenced dlls in the bin
folder. If you are using version control, bin and obj folders should always be completely excluded.
All referenced dlls should be included under version control, preferably in a separate subdirectory under your project's trunk
, so that everyone has all necessary sources and references for each clean rebuild. bin
folder must easily be recreated from scratch.
That's something that I believe most people will expect when checking out your source.
We also include a _READ_ME.txt
file in the root of the project, stating additional info on tools and stuff needed to batch-build the project (nant
, perl
, etc.), so there may be some specific differences from time to time, but never surprises of this kind.
No this makes complete sense and is a practice I myself implement on personal projects. Anything under the bin folder should be treated as property of the msbuild / Visual Studio environment.
While they both take great care to only delete the outputs they know about, it's possible for the user to not fully understand what is the build output and copy over a build output and consequently have it deleted during a "Clean" style operation. It's also possible for other tools to be more aggressive here in cleaning out DLL's. I myself tend to nuke the bin directory from time to time if I think the build process is looking at stale data.
Additionally having a ref's location gives you a single place to update references for a collection of projects within a solution. For me it's a very natural construct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With