Subversion for Visual Studio Users

by fwhagen Tue, 14 October 2008

VisualStudioLogo subversion_logo-200x173 There are a few articles online covering SVN and VS, but many are out of date and a bit more complicated than necessary with advances in both products.  For a current install (Oct 2008:  SVN 1.5.2 / VS2005), you only need 3 files:

Subversion is, of course, the Source Control server itself.  The MSI install contains everything needed to run on a Windows server.

TortoiseSVN is a plug-in for Explorer that gives a great deal of control to the source repository using the right-click context menu.  Check-ins, updates, merges, etc. can be done through this interface as well as full repository browsing and maintenance.

AnkhSVN is the most important tool for the .NET developer.  It integrates the controls needed for team development directly in the environment.  Much like the integration offered through VSS, but much better.

Installation of Subversion itself is very easy.  Just run the installer.  I installed into C:\SVN\ instead of the default "Program Files" directory, but I am lazy and hate spaces in filename on the command-line.
NOTE:  The installer only puts the files in place and sets the important environment variables.
Once installed, the following command is used to setup a repository:

svnadmin create "D:\SVN\Repository"
You can create as many repositories as needed, but one for now.  Before we activate the server, two config files need to be edited.  They were created with the repository above.  They are svnserve.conf and passwd in the conf sub-dir of the repository.  Uncomment the following:
~/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
password-db = passwd

~/conf/passwd
[users]
harry = harryssecret
sally = sallyssecret

Now the installation can be tested. Execute the following command in a command window:

svnserve --daemon --root "D:\SVN\Repository"

To create a project, execute:

svn mkdir snv://localhost/newproject

Now would be a good time to install TortoiseSVN if it hasn't been yet.  Connect to the running server from within an explorer window by right-clicking and selecting TortoiseSVN > Repo-Browser.  Enter the name of the server to see the interface using the following URL:  svn://servername/  The project "newproject" should be viewable there.

And now the most difficult part of all:  Installing SVN as a service in windows.  The following command will accomplish this.  Syntax and proper spacing is critical.  (I was having problems until I realized the space after each '=' in the command.)  Here it is:

sc create SVN_CSTeam binpath= "c:\svn\bin\svnserve.exe --service --root D:\SVN\Repository" 
displayname= "Subversion Repository for CSharp.NET Team" depend= iisadmin

And that is why I do not use the default paths.  Spaces have to be delimited with quotes, which have to be escaped, and it just is not worth it.  All on one line of course.  Also note that the name after the "create" parameter can be anything desired and allows for multiple repositories on the same server, along with unique displayname.  I chose to use iisadmin as a depend, not because it necessarily is, but because it is sure to load other depends such as Tcpip and such.

The last step is to load AnkhSVN; a solution I leave to the reader.  It's not hard.  If you are familiar with source control at all, it is pretty obvious.


I'd like to thank the following sites for very useful information in helping me through the installation and the creating of this post:

Keywords: ,

Filed Under: .NET | Programming

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

TextBox

RecentPosts