Search code examples
c#.netbuilding

Shouldn't you treat the bin folder as being transient?


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?

UPDATE : Turns out i'm not mad

Cheers guys you've picked up on some points I forgot to mention.

Mainly :

  • Not checking the bin folder into source control

Solution

  • 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.