Thursday, October 29, 2009

Organizing mutiple Visual Studio solutions and multiple SVN repositories

Often when developing a project that has many components solution grows so big that it becomes quite messy, VS lags. When you check out Editor you'd like to work with you have to drag rest projects sitting there in repository. And so on.

The typical scheme will look like this:
What do we have here? We have project Core that holds domain objects and logic. Next in the same solution we have ReportsGenerator settled down. Also there some of your mates work on editor that also is using Core project indirectly.
Now say you want to develop/bugfix/just check what's going on in your ReportsGenerator. You have to checkout whole repository full of other logical parts like Editor and load big-ball-of-mud-solution with alot of files you dont care about at all.

However when working with VS solution you're able to reference project from another solution so it isnt nessesary to work with one big solution at all. You create your own solution ReportsGenerator, inside of it you create projects you would like to work with and then you reference to Core project of another solution. The developer working on Editors does pretty much the same thing. So now you both have references to the same Core project while working in 2 separate solutions.

Now lets think how does this work with SVN repository. One way is to keep everything in single repository. That way when you would like to checkout your ReportsGenerator solution you're in trouble: which referenced projects should be checked out as well? How will you know that ReportsGenerator is dependant on Core? Maybe it also has dependecies in Controllers project?

To solve this problem SVN repository externals property can be used. Whole picture is going to look like this:


Every solution now sits in its separate repository allowing easy check outs.

With externals tuned another developer checking out WPF_Editor code from its separate repository will also trigger check out for Controlers repository and Core repository. And he will work in his own separate solution for WPF_Editor. He has full access to Core solution, he can alter some classes and check them in, everyone else working on other dependant projects will notice that Core changed and can update it with SVN as usual.

Externals property can be used to reference a specific revision of folder in another repository so you wont get surprised when 3rd party library drastically changes.

Good guide into externals properties of SVN can be found here: