1

I'm working on a .NET project with Visual Studio and it's Git extension. Until recently, the whole bin folder was excluded from version control in the .gitignore file. It is now included because of missing dll files that prevented new developers from building the project. However, each time I commit now, two files have changed: [Project name].dll and [Project name].pdb. They're obviously auto generated and I'd like to know if it's reasonable to exclude them from version control again. Is it possible even it the containing bin folder is included?

smcs
  • 1,772
  • 3
  • 18
  • 48
  • 2
    basic rule: never add compiler generated files to source control. Also most of the generated files are binaries, and are heavy load on the source control, as for every change the entire new binary is stored, where for source code (text file) only changes are stored – bansi Mar 22 '16 at 06:02

3 Answers3

3

Not really, they are transient and shouldn't be source controlled.

Instead it isn't building because you have dependencies that it is relying on. You should get those dependencies and either move them into a separate folder and change your references to point to them and if you have to check that in but preferably you would put the dependencies in a nuget package or on new dev machines install xx to get the dependencies.

Checking in your build folder is bad as I suspect if someone did a "clean" on their build folder and checked that in, when the next person did a pull it would likely break for everyone as if it was a new developer machine!

ed

Ed Elliott
  • 6,666
  • 17
  • 32
  • That sounds like good advice. I added the lines `[Bbin]/DKTProject.pdb` and `[Bbin]/DKTProject.dll` to the `.gitignore` file, however they both still appeared in Visual Studio as uncommited changes. I then read that `.gitignore` only ignores files that haven't been tracked before and tried `git rm --cached` on both files (according to http://stackoverflow.com/questions/4308610/how-to-ignore-certain-files-in-git). Now they still show up in VS as uncommitted changes, but crossed out. Should I not have done that? So confusing – smcs Mar 22 '16 at 06:46
  • I would just make sure you have the github visualstudio .gitignore (https://github.com/github/gitignore/blob/master/VisualStudio.gitignore) and then anything in the bin folder will be ignored. – Ed Elliott Mar 22 '16 at 10:32
1

As per the this recommended .gitignore file, found here

You can see that the dlls and the pdb files are excluded. Those .gitignore files are based on best practice, and where possible I would stick to this.

JanR
  • 6,052
  • 3
  • 23
  • 30
1

At least the PDBs shouldn't go directly into source control, but if applicable be indexed on a symbol server to be able to debug earlier revisions of your code.

Lennart
  • 9,657
  • 16
  • 68
  • 84