Using Subversion with a Windows .NET C# project

The following guide has been adapted from the blog posting referenced below.

Note: To use Subversion with web projects you will need to enable the Subversion hack to use _svn directory names instead of the default .svn (which are incompatible with ASP.NET web projects).

1. Import the existing C# project(s) into Subversion.

svn import svn://svn.url/ProjectName/trunk -m "Initial import of ProjectName"

2. Once imported you must delete the existing code (or move to a backup location) and then checkout the source from Subversion.

svn checkout svn://svn.url/ProjectName/trunk .

This will create a working copy in the current folder.

The next step is to ignore certain files and directories that should not be stored under version control. These include user-specific files (*.suo) and the bin and obj directories (where the compiled output goes).

3. Change directory to the folder than contains the solution file and issue the following command (note the dot at the end):

svn propedit svn:ignore .

Subversion should pop up Notepad (by default) for you to edit the value of the property. If it doesn’t, set an environment variable called SVN_EDITOR to notepad.exe. In Notepad, type in the following:

*.suo
Ankh.*

4. You’ll also need to make sure some files and folders are ignored for each of the projects referenced by the solution. To do this, type in the following command, once for each of your project folders:

svn propedit svn:ignore <ProjectName>

In the Notepad window, type the following:

*.user
bin
obj
Bin

5. Finally all of these changes need to be commited via the following command:

svn commit -m "Set files and folders to be ignored"

References

Subversion on Windows


About this entry