Sharing assembly versions across multiple solutions

Some time back, I blogged about the sharing assembly versions across a solution here. However, in a multitier architecture, not every project reside in the same solution. Developers usually categorize their solutions based on modules / projects. Web application resides in one solution along with business objects, database in another, web services in another and jobs in one other solution which may all be deployed on different servers.

In such cases the concept of linked files does not apply because when you link the shared assembly file, that file should be present on each server. However there is a simple solution where-in you can still link your shared assembly file to a file on disk and update the assembly version in the shared assembly file and reflect in all solutions and projects.

By now we know how to add a linked file to a project. If not you can read my blog post here. After adding the linked file, right click on the shared assembly linked file and select properties. Set the following properties:

Build Action: Compile

Copy to Output Directory: Copy if newer

There you go. Now whenever you publish the solution, the linked file SharedAssemblyInfo.cs /SharedAssemblyInfo.vb file too gets copied over to the bin folder. As soon as you change the version in the SharedAssemblyInfo.cs file on the disk and build again, the SharedAssemblyInfo.cs /SharedAssemblyInfo.vb file gets copied over.

Hope this helps !!!

No Comments