views:

505

answers:

9

I'm new to Visual C# Studio (actually using the Express edition, but another developer is using the full version), and we are using version control (svn).

It's acceptable to me to add the project files to the repository, since this repo is just for the two of us using Visual C# Studio. But it feels like there are some irrelevant files in there. Can someone familiar with Visual C# Studio project files tell me which files can safely be svn:ignored?

Some suspect files:

  • project.csproj
  • project.csproj.Debug.cachefile
  • project.csproj.user
  • project.sln
  • project.suo
  • Content\Content.contentproj

I'm sure the .sln is required, but what's this .suo? and the .csproj? Can/should any of these be generated by Visual C# Studio on loading a project?

A: 

We also work with Visual Studio C# and SVN and I don't know about all the project files, but we only exclude the complete bin directory.

MysticEarth
+3  A: 

The .sln file defines your solution together with the .proj files (one for each project), so keep them in your svn!

You can skip the .suo file (personal settings - binary anyway) as well as the bin or obj folders. Also the .cache files can be left.

twk
A: 

Needed...

*.sln - The solution file contains references to all the projects and dependencies between the projects.
*.csproj - The project files themselves. These tell what files are included in the project, references, and the build steps for the project.

Not...

*.suo - This is a user settings file...

Jason Punyon
+8  A: 

Shouldn't be versioned:

  • .csproj.user is the user's project file settings (e.g. startup project)
  • .suo is the user's solution file settings

Should be versioned:

  • .sln is the solution file itself (what projects it contains etc)
  • .csproj is the project file

I'm not sure about "contentproj" but it sounds like it's a project file which should be under svn.

Jon Skeet
A: 

You definitely need csproj files... You might want to try AnkhSVN or VisualSVN, those VS addins add only the required files to SVN.

Or you could remove files from your directory structure until it does not load anymore.

I suggest experimenting this way because it is a great way to learn how a solution is structures by VS.

gmagana
+12  A: 

Dont include
bin
obj
*.suo
*.user
_Resharper* (if you have Resharper)

Include
*.sln
*.csproj

Carl Bergquist
What's R#? Does my asking that question mean I don't have it?
Kai
A: 

I leave out the Visual Studio Solution User Options file (*.suo) and the binaries directories as they get recompiled everytime you build your solution (the bin and obj folders).

kappa
+9  A: 

.csproj defines the project structure. It is vital.

This is what I add to my global ignore list in Tortoise SVN:

*.suo *.user bin obj *.pdb *.cache *_svn *.svn *.suo *.user *.build-res TestResults _ReSharper*
Agent_9191
+1  A: 

Just to add, anything that gets regenerated at build time, should be excluded. For example, files generated from the prebuild event or in some cases a custom tool.

leppie
That's not always the case. Files generated by a SingleFileGenerator, plus designer generated files associated with .xaml, .resx, and forms should be checked in.
280Z28
That's exactly why I said some cases.
leppie