Skip to main content
Enterprise Agile Planning icon with arrows

This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.

Last Updated Mar 15, 2010 — Enterprise Agile Planning expert

AnkhSVN and Visual Studio Interactions

Enterprise Agile Planning

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;


C:MyProjectsTutorialSvnMyLibrary

MyLibrary.sln

MyLibrary.csproj

MyApplicationClass.cs

In SVN, the folder structure would look like this;

/TutorialSvn/MyLibrary/
trunk/
MyLibrary.sln
MyLibrary.csproj
MyApplicationClass.cs

If we branch the solution from within VS, call the branch ‘development’, and commit it,

this is what SVN looks like:

/TutorialSvn/MyLibrary/
trunk/
MyLibrary.sln
MyLibrary.csproj
MyApplicationClass.cs
branches/development/
MyLibrary.sln
MyLibrary.csproj
MyApplicationClass.cs

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

like this;

C:MyProjectsTutorialSvn
TutorialSvn.sln
MyLibraryTestHarness
MyLibraryTestHarness.sln
MyLibraryTestHarness.csproj
HarnessProgram.cs
MyLibrary
MyLibrary.sln
MyLibrary.csproj
MyApplicationClass.cs


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

More from the Blog

View more
Digital.ai Government Cloud
Apr 12, 2022

Digital.ai Government Cloud receives FedRAMP Authorization through sponsorship from the United States Department of Veterans Affairs

Enterprise Agile Planning
Flagship Digital.ai Agility solutions can effectively scale agile deve ...
Read More
Nov 22, 2021

What are the qualities of highly effective agile teams?

Enterprise Agile Planning
A team is the core unit of productivity in an agile organization. Wher ...
Read More
Nov 15, 2021

How an open-first attitude revolutionized government tech development

Enterprise Agile Planning
Public perception of government is often that it is slow-moving, reluc ...
Read More
cross functional
Nov 08, 2021

6 best practices for building resilient cross-functional teams

Enterprise Agile Planning
Agile frameworks prize the quality of resilience within every facet of ...
Read More
Contact Us