Using SVN With Visual Studio 2010

SVN is a must have for managing projects and keeping them proper, with a history of changes, what should be done when 2 versions of the same file are changed and so on. It’s so important even for a developer working alone, since code will be never lost.

This post is a quick work through on how to install and use SVN on Windows and Visual Studio, you can read more about SVN here.

First, you should know that having a subversion client on Windows is sufficient, you can do all the stuff in there without the need to have it integrated with Visual Studio, but if you are like me, want perfect handling from within VS then you can go further to integrate it there as well.

We will use TortoiseSVN, a free Subversion client for Windows which integrates a cool shell menu to handle the different SVN commands, install it from here. Once installed you will notice a new shell menus.


After that, you have to create a repository (for guys who work on their machines). It is quite simple, you create an empty folder, this folder will be the location where all the history of the projects is saved, so make sure it somewhere safe.

Within this folder, right click and choose TortoiseSVN -> create repository here. Once created, you will notice the following contents added to the folder :


Now, you have to choose the repository structure, with whatever structure you want (see the recommendations for that here), right click the content of the directory and choose TortoiseSVN –> import.

With a repository created and with a structure ready, you can start playing with projects from Windows explorer, for example create a Directory and inside it create a text file, then choose SVN checkout, this will add the content to the repository


You will notice a little green bullet within the icon of the folder, which means the local content is updated compared to the content of the repository, let’s try something else, create a new text file inside that folder, then right click it and choose TortoiseSVN –> add to repository, this will make a little “+” sign with its icon, which means it’s ready to be committed. At this stage you will notice that the parent folder has changed to a red icon, which means it’s not up to date with the repository anymore.

4 5 7

Right clicking this file, choose SVN commit will bring this screen, where you can add messages to keep history of changes.

That’s generally how it works from within windows explorer, after the commit of this file, a new green icon will be back again to the parent folder, of course you can commit the parent folder and all the content will be committed, you can compare differences between local content  and the repository content and so on..
You will find all the commands within the shell menu, and they appear only on folders that you added to the repository, hitting shift + right click will bring more commands

Pretty cool, so what about Visual Studio?
Actually you can do the same from the Visual Studio 2010 (or other versions), from the document explorer precisely, there is a free plug-in called AnkhSVN found here

Once installed, it will bring Subversion functionality to Visual Studio, you can verify it’s installed well, and also configure some aspects from Tools –> Options –> Source Control


Create a new project, you will notice a little checkbox asking if you want add this project to Subversion or not, then you will get a parameters window where you can configure: the repository to use, the local folder and so on, I’m using a repository through http here, you don’t have to use only local repositories.

9 image

Everything is setup now, on the solution explorer you will notice the “+” signs on the contents, which means they are waiting for a commit to the repository, AnkhSVN bring the same functionality to the project explorer that TortoiseSVN brings to the shell menu (tip: AnkhSVN uses TortoiseSVN repositories, they are not the same), so you will notice the same, red, green icons as well, right clicking a file and choosing SVN –> commit will commit the file to the repository.


You can compare files before updating or committing by choosing Subversion –> Compare


There are dozens of other functionalities also, you can read more about TortoiseSVN and SVN in general from their website

Posted in , , . Bookmark the permalink. RSS feed for this post.

comments powered by Disqus

Swedish Greys - a WordPress theme from Nordic Themepark. Converted by