What files / folders in Visual Studio 2010 C # Solution should be included in Mercurial DVCS?

I am using Google Code to host my C # project. It has a solution with one class library and one test project. I am using Visual Studio 2010.

The client I use is TortoiseHG.

In Windows Explorer, I first cloned an empty folder and got the .hg files inside it to associate it with my hosted code. Now I created a new C # project and copied all the files to the folder with the root source code. I will work on this in the future.

When making decisions in my folder, there are many files and folders, and not all of them are code. Usually I just build and take out the EXE or DLL and never worry about other things. Now I feel that not all files and folders are important for source control.

I am really new to version control.

What files / folders should be included in the source control other than the code files themselves?

+6
mercurial visual-studio-2010
source share
2 answers

Good question! I use the following rule:

  • Check all the files in the folder to have a complete tree
  • Work with it and pay attention to pending checks.
  • The expected files, but you did not touch the Visual Studio files, which are updated while you are working, to save the project settings.
  • Now be careful: the *.sln , *.csproj files and other project files will also be modified. They must be marked.
  • Other files, especially. those that β€œwatch” binary (for example, in the obj and *.suo ) can be marked for an exception list.

You can include embedded versions of the DLL or EXE, but this is not necessary, since any loading of your project can build it. Now the next step:

  • After you have done a little work and think that you have created a stable list of files, move the entire project to another place and immediately compile it. It works? Does it skip files?

If this last step works (and you should check it on a regular basis), you have a solid foundation for your files.

Note. Some tools support Visual Studio internally and know which files should or should not be included, i.e. for SVN. I know that VisualSVN does a pretty good job of skipping unnecessary files.


Two more rules (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;
  • Several extensions that can be safely excluded: *.user (the root of any project), \obj\** (all temporary obj folders), *.vspscc and *.vssscc (the root of the project), *.suo and depending on your preferences: \bin\** .
  • Oh, and for website projects, they can contain or add the PrecompiledWeb directory to your solution that you really don't want to check: exclude everything here.

EDIT: This SO question has a very extensive list for ignoring Visual Studio.

+5
source share

To give a shorter version of @Abel's answer, you can leave the bin and obj folders and the .suo file. Everything in bin and obj will be recreated when it is built, and .suo are user settings for the project that no one needs.

+2
source share

All Articles