Sitecore Helix: How to use one assembly files for all the assembly version

You are using Helix principles with your Sitecore project.

Great!!!

You are listening well to the Sitecore Gurus and following the divine path.

You are setting up TDS, MsBuild server and Octopus deploy for you Continuous Integration.

Sweet!!

You might run into issue where you need to have consistent Assembly version for all the projects. You are energetic, you go change your AssemblyInfo file for all 50 different project in your solution and see the code flow from your machine to MsBuild server to Octopus and to your Int or QA.

Life is Good !!!

Except, your boss hires an intern, who is high energy¬† and start doing lot’s of changes. And forgets to update assembly versions on few of those 50 projects…. now your build server throwing up Red bars at you….grrrrrr.

Fire the intern…. wait, you really need someone to help you with other tasks. So what should you do. Only if you could make things simpler.

Well, I will give you a solution before you finish that cup of coffee.

Use a Global Assembly file.

How?

  1. Open any of the MVC project you have in your solution.
    1. Expand Properties.
    2. Double Click AssemblyInfo.CS and copy the whole thing.
  2. Create a new CS file where you Solution is located (.sln file). Call it GlobalAssembly.cs
  3. CRTL+A and CRTL+V on the file to delete everything and replace it with the code you copied.
    1. Delete the line where it says [assembly: Guid(“………..
  4. Right click on solution and create a New Solution folder (This step is not necessary if you have a folder name configuration)
  5. Right click on solution, add existing items and select GlobalAssembly.CS.
  6. Go to your MVC project(s)
    1. Right click on the Properties
    2. Add existing item
    3. Select the GlobalAssembly.cs and “Add As Link” instead of the standard (There is a dropdown on that button to choose between those)
    4. Remove all the lines except the [assembly: Guid(“…………… and on the top using System.Runtime.InteropServices;
  7. Do this for all the MVC projects.
  8. Build
  9. Keep the intern.

 

Good luck.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.