|||

SVN Externals — Share common assembly code between solutions

If you are like me and you have a similar problem of having to share common in-house library code between various Visual studio solutions and you are using SVN for your source code control, then SVN Externals might be a good option to consider.

In my scenario, I had a class library which contains a lot of utility classes that are shared amongst different applications I write. Before starting a new project, I would typically create a Solution Items / bin folder in the solution directory of the new project and would place the compiled library dll in this folder which gets checked into SVN repo along with the application code. This approach sort of worked but had the following pain points:

  • Before starting a new project, I had to get the latest version of the library code from the repo. Compile it and grab the dll and place it in the solution items folder of the new project.

  • When I added more functionality to the library code, the existing solutions could not benefit from it.

  • I could not debug the library code from within the application solution, unless i used Reflector Pro to decompile the library.

Found out about the SVN externals options and it has helped me great deal in addressing all the above issues, so I thought it might be worthwhile sharing.

Lets say you have a very simple library solution as follows:

image

and it is checked into a SV repo as follows:

image

AppOne and AppTwo folders have 2 different applications that need to share the Utility class in the MyLibrary solution. Both these applications are already checked into the repo in their respective folders.

To add The library code as an external link to AppOne, I had to right click on the AppOne folder, choose properties and the following:

image

To add the library project link, I had to:

image

and the Working copy Subverion properties window looks as follows:

image

Now all that is left to do is right click on AppOne working copy folder and choose SVN update and the Library code would be checked out into AppOne working directory.

image

One of the last things to do is to open the AppOne solution in Visual studio and add the library project by choosing the Add Existing Project option and checking the entire solution back again.

After the solution is checked in this is how the repo browser looked like. It clearly shows MyLibrary.Common with a shortcut icon.

image

The beauty of this approach is that as soon as I make some changes to the library solution, it is immediately reflected in AppOne when I update my working copy.

image

This is how AppOne solution looks like.

image

and any changes made to the Library code from within AppOne would reflect in the Library solution as well.

Up next Simple async in .net 2.0 & Winforms If you are like me (a lay-dev) and you swing back and forth between writing .net 4 and .net 2 apps. You are also asked to write simple Simple logging with NLog Application logger
Latest posts Flutter CI/CD with Azure Devops & Firebase - iOS - Part 1 Flutter CI/CD with Azure Devops & Firebase - Android - Part 2 How to samples with AWS CDK A hashicorp packer project to provision an AWS AMI with node, pm2 & mongodb Some notes on Zeebe (A scalable process orchestrator) Docker-Compose in AWS ECS with EFS volume mounts Domain Driven Design Core Principles Apple Push Notifications With Amazon SNS AWS VPC Notes Building and Deploying apps using VSTS and HockeyApp - Part 3 : Windows Phone Building and Deploying apps using VSTS and HockeyApp - Part 2 : Android Building and Deploying apps using VSTS and HockeyApp - Part 1 : iOS How I diagnosed High CPU usage using Windbg WCF service NETBIOS name resolution woes The troublesome Git-Svn Marriage GTD (Getting things done) — A simplified view Javascript Refresher Sharing common connection strings between projects A simple image carousel prototype using Asp.net webforms and SignalR Simple logging with NLog Application logger SVN Externals — Share common assembly code between solutions Simple async in .net 2.0 & Winforms Clean sources Plus Console 2 — A tabbed console window