Skip to main content
Enterprise Agile Planning Image

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
Jul 27, 2021

Digital.ai Becomes First to Achieve FedRAMP Moderate “In Process” Status for Enterprise Agile Planning Solution

Enterprise Agile Planning
Digital.ai, the leading AI-driven DevOps value stream delivery, and ma ...
Read More
Jun 21, 2021

How Agile can be implemented effectively across the organization

Enterprise Agile Planning
Just a few decades ago, a “disruption” was seen as an undesirable thin ...
Read More
May 31, 2021

Agile change management processes are key to delivering software faster

Enterprise Agile Planning
With its emphasis on delivery value faster, agile product management s ...
Read More
May 03, 2021

Bringing the agile planning approach to your whole business

Enterprise Agile Planning
The events of the last 12 months have demonstrated that the only sure ...
Read More
Contact Us