This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.
CloudForge for Microsoft – Connecting Visual Studio to SVN
A few months ago I wrote a blog detailing how to connect Eclipse to a TeamForge Project in CloudForge. I wanted to follow-up that post with an analogous walk-through with Visual Studio and CloudForge. For the purpose of this blog I am using Visual Studio 2010 but the same steps apply to Visual Studio 2008 as well.
This will be a three-part blog. The first part will cover creating a new project in CloudForge and uploading source code into a centralized Subversion repository. The second part will cover integrating issue tracking and agile project management with TeamForge into our Visual Studio and CloudForge project. Finally, the third part will bring all of it together providing traceability between changes in my source code and tasks in my issue tracking.
Before we begin, you should download and install the CollabNet Desktop for Visual Studio. This download includes both the libraries required to connect to TeamForge as well as AnkhSVN – the Subversion client for Visual Studio.
Now that the CollabNet Desktop is installed we are ready to roll. First, we need to make sure the CollabNet Browser is visible so we can add our project to CloudForge. Click on View->Other Windows->CollabNet Site Browser:
This will open a new pane in Visual Studio for the CollabNet Desktop. This CollabNet Site Browser Pane should show a few default connections to communities like openCollabNet where you can get more information about TeamForge, SVN, and AnkhSVN. We want to add a new site here. Right click in this pane and choose “Add CollabNet Site”. As you can see, it is possible to use the same client in Visual Studio to connect to any CollabNet product or community. For now, we are just focused on CloudForge so choose CloudForge and enter in your credentials.
Now that we have a connection to our CloudForge account we can interact with all of our existing projects directly from Visual Studio; based on the access controls set up in CloudForge, of course. We can browse our repositories and checkout code or even update, create or close artifacts within TeamForge. For the purposes of this blog, I’m going to create an entirely new project linking Subversion, TeamForge, and my code; all without leaving Visual Studio.
Note: This walk-through makes heavy use of the right-click menus. Most of functionality of the CollabNet Desktop, AnkhSVN, and even Visual Studio is exposed in contextual, pop-up menus. If you’re ever in doubt about where to find a feature here, right-click.
AnkhSVN includes a full repository browser that will allow us to not only browse the repository but modify and change the repository directly. Let’s create some directories in the repository to maintain separate workspaces between our main trunk and our branches. How to structure branches in Subversion is beyond the scope of this blog but there are many resources available online for help in creating best practices.
After the repository is created and configured we can add our source code to the repository. It’s possible to add existing solutions and projects to the repository or add a new project to the repository. In this example I am creating a new web application within Visual Studio but the steps are the same to add an existing project once the project is open in Visual Studio.
We have the choice to track our Visual Studio Solution (.sln) within our repository as well as all of our project files. This gives us the ability to share projects in different solutions. Other users can simply connect to our SVN repository and checkout the project files into their solution. The solution libraries can be stored in a separate section of the repository or in an entirely different repository. Here, I’m simply storing both the solution and project files in different locations within my repository.
If you’re only interested in storing your VS project within a CloudForge SVN repository then you are ready to go. Based on the steps we have taken so far our source code has been uploaded to CloudForge and all revisions can be tracked in a centralized repository. Just make sure to remember to commit changes.
Remember to come back next week for part 2 of this blog to bring issue tracking and Agile project management into the picture.