Tuesday, November 16, 2010

Version Controlling : Adding Subversion to Visual Studio 2008

For a software developer, keeping a track of the projects and its versions is critical. So, people use to get the support of a version controlling system. Visual Studio 2008 doesn’t have an built-in version controlling system or mechanism. But still it provides you the Source Control Integration facility; which enables two options: source control solution based on the Source Control Plug-in API, or a source control VSPackage.

Here, in this post I’m going to explain how I add the the subversion support to my Visual Studio 2008 - Professional Edition installation. I have used AnkhSVN, a subversion source control provider for Visual Studio.  Along with that you need to use another Subversion client such as TortoiseSVN, in order to create a Subversion repository/repositories in your computer.

What is Subversion ?

Simply, subversion (often abbreviated as SVN) is a version controlling system. That is, Subversion manages your files and directories, and the changes made to them, over time. This allows you to recover older versions of your data or examine the history of how your data changed. Therefore, you can version your work and roll back in to a specific version later. Of course you can use subversion across the network, which eventually allows you to work more productively in a team. Because subversion provides the ability for various people to modify and manage the same set of data from their respective locations without conflict.

CollabNet founded the Subversion project in 2000 as an effort to write a better version-control system which operated much like CVS. But which fixed some of the bugs which previously CVS had, and also supplied some new set of features.

I have went through few subversion source control providers for Visual Studio; VisualHG, SilkSVN, SourceAnywhere are also good tools but for me I selected AnkhSVN. 

Installation and Configuration

First, download the latest version of the AnkhSVN form here, and run the installer package. Well, that’s what all you have to do for installing it. Then open your Visual Studio. Then go to the Tools –> Options.. –> Source Control and select AnkhSVN as the “Current Source Control Plug-in”. If you were running the Visual Studio while you install AnkhSVN, you might have to close and re-open VS to take the effect.

Then download TortoiseSVN from here, and install it. You need to restart the machine after the installation. Now we have to create a SVN repository using TortoiseSVN. It’s really easy. Create a folder anywhere you like Then right-click the folder and select “TortoiseSVN” –> Create repository here.. I have created a repository called “TestSVN” as displayed in the picture.

A message box will appear with a message that the repository was created successfully. Remember you have to do this in order to connect your solutions to SVN in Visual Studio (using AnkhSVN)

Add a Solution/Project to a Repository

If the above configurations were done, you can see a check box “Add to Subversion” when you open the “New Project” dialog box. Using that, you can directly add a solution to your SVN repository.

Or, if you want to add a solution which you have already created, right-click your solution and select “Add Solution to Subversion”. To add specific projects rather than the containing solution, you can select “Add Selected Projects to Subversion” instead.

Either way, you will be directed to the “Add to Subversion” dialog appears. The project's name and location of your working copy are automatically filled in. See the picture below.

It asks for the repository URL. I shall recall you that, here in this example, we just only created a local repository for the demonstration purposes. But it could also be a repository in your LAN or Internet. You can connect to any of these by giving the URL. For this one I’m providing “E:\TestSVN” which is the path for the repository which I have created a short while ago.

My recommendation for you is, add the solution in to a new subdirectory. To do this, select the “Create Folder” option, and enter a directory name and log message.

If your project might need to create branches to the main line of development (probably we will look in working with branches in a separate post), creating a trunk folder to store the main line is the best option. To do this, check the “Add trunk folder for Project” option. After doing the setting according to your interest, click OK to continue. Then another window will appear asking for a log message, fill it.

Now the solution is connected with the SVN repository, you can see it by looking at the changes happened in the solution explorer.

That is all you have to do for connect the Visual Studio with SVN. Then next step is to use it for your versioning purposes, but the post span a little bit long. So, I’ll explain how to use the SVN  with your Visual Studio projects in a separate post.

Read the second part of this article.


  1. hey, this is cool. thanks. this post was helpful. i'd call it a good alternative to the team system.

  2. Still I believe Visual studio team server is the best. No doubt this is a good alternative but the support to the VS environment and interoperability is not that much good. Hence, this doesn't provide the best team experience.

  3. I use Agent SVN. It works great with VS.


Had to enable word verification due to number of spam comments received. Sorry for the inconvenience caused.