This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.
AnkhSVN and Visual Studio Interactions
This blog describes differences between Microsoft Visual Studio (VS) and Subversion (SVN)
project structures and usage of AnkhSVN ( A Subversion plug-in to VS) with Visual Studio.
It further explains branch/merge scenarios with some examples.
At first, let’s distinguish between a Visual Studio (VS) project and a Subversion (SVN ) project.
A SVN project is a folder. A VS project is a group of files that produces a single binary target
(dll, exe, lib). A VS studio project is analogous, but not identical to a makefile.
A VS solution on the other hand is merely a grouping of related VS projects, it has no concept
of a build target. VS creates a solution for every project, but you can also create solutions
ad-hoc, and add projects to them. Frequently, a VS project belongs to two or more VS solutions.
Further, developers frequently create VS solutions locally on their machines as part of the
development and debugging process, but these solutions are “throw aways” which don’t
get checked in.
A SVN project has sub-folders for ‘trunk’, ‘branches’, and ‘tags’..
For instance, if we have the following working folder structure;
In SVN, the folder structure would look like this;
If we branch the solution from within VS, call the branch ‘development’, and commit it,
this is what SVN looks like:
Switching between ‘trunk’ and ‘development’ causes SVN to replace the contents of the
working folder (i.e. MyLibrary) with the appropriate branch. The working folder does not
mirror the SVN repository’s structure. Instead, the working folder’s contents get wiped out and
replaced with the contents of either trunk/ or branches/development/, depending on which branch
you ‘switch to’.
Now suppose we have a test harness (console executable) that exercises MyLibrary.dll.
We may want a new solution to host both VS projects, and a working folder structure that looks
In the above example, MyLibrary.csproj is included in two different solutions;
MyLibrary.sln and TutorialSvn.sln.
Likewise MyLibraryTestHarness is included in two different solutions.
I may want to branch MyLibrary.csproj without branching the test harness. Since SVN “switch”
occurs in-place, the project references in TutorialSvn.sln will remain correct regardless of
whether MyLibrary has been switched to ‘trunk’ or to ‘development’. Same thing goes for any
references from the test harness project to the library project.
Merging is a whole different discussion which requires you to wrap your head around the
concepts “merge from” and “merge to”, the rules of which can be quite counter-intuitive at first.
But once the rules ‘click’, they make sense.
Steps to create merge scenarios:
1. create a new project
2. branch it
3. edit the branched copy
4. merge the branch back into the trunk
5. edit the trunk
6. edit the branch
7. bring the branch up-to-date with changes in the trunk by merging the trunk back into the branch
8. merge the now up-to-date branch back into the trunk