Tigraine

Daniel Hoelbling-Inzko talks about programming

Sharing a common AssemblyInfo between projects in a solution

Posted by Daniel Hölbling on January 22, 2009

Since I’m doing more and more layering I also started to split up my layers into different projects so I can’t bypass any layer by accident.

This leads to solutions with 10+ projects sometimes (tests, setup, etc..) and that looks like this sometimes:

image

So, that’s great and I can only recommend that. You get much better view over what dependencies your application has internally.

But that leads to one problem: Versioning the assemblies.
I don’t want to go through 10 projects changing AssemblyInfo.cs to correspond to the real version of my application. Since I only do the splitting into different projects to ease development, I always want all assemblies to have the same version. So, how to tackle this?

Simple: Create one master AssemblyInfo.cs (just copy one of the existing ones), and delete the others from the other projects. We want to re-insert the file, but this time as a link so changes to one AssemblyInfo.cs cause all projects to have a changed assembly information.

image

Yes, that’s right. There is a way to reference a file without copying it into the folder (well hidden behind that arrow there).

So, now the file shows up in the solution explorer twice, but changes will spread to other projects too:

image 

When having a MSI project, it won’t update a referenced assembly during setup if there hasn’t been a change to it’s version number. So I ended up installing a new version of the GUI component while the changes in the controller assembly didn’t install because there was no increment in version number. Annoying, but not so much of a problem once you know how to handle it :).

Filed under net
comments powered by Disqus

My Photography business

Projects

dynamic css for .NET

Archives

more