Good question! The rule of thumb that I use is the following:
- Check in all files in the folder to have a complete tree
- Work a bit with this and notice the Pending Checkins
- The files that are pending but you haven't touched are Visual Studio files that are updated while you work to keep settings of the project.
- Careful now: the
*.sln
, *.csproj
and other project files will change as well, these must be checked in.
- Other files, esp. the ones that "look" binary (in the
obj
dir and the *.suo
file for instance) can be marked for the exclusion list.
You may decide to include the built versions of the DLL or EXE, but this is not necessary, as anybody loading your project can built it. Now, the next step is:
- After you worked a bit and think you've created a stable file list, get the whole project to another location and compile immediately. Does it work? Does it miss files?
If this last step works (and you should check it on a regular basis), you have a solid basis for your files.
Note: some tools support Visual Studio from within and know what files should or should not be included, i.e., for SVN I know that VisualSVN does a rather good job of skipping the unneeded files.
Two more rule of thumbs (oh, three, actually):
- Be specific in what you exclude, be liberal in what you include: it is better to include too much than too little;
- A few extensions that can safely be excluded:
*.user
(root of any project), \obj\**
(all under the temporary obj
-folder), *.vspscc
and *.vssscc
(root of project), *.suo
and depending on your preferences: \bin\**
.
- Oh, and for website projects, these may contain or add a
PrecompiledWeb
directory to your solution, which you really don't want to check in: exclude all here.
EDIT: this question on SO has a very extensive list of files to ignore of Visual Studio.