3

We have a project that uses a couple of assemblies.

Is there an easy way of handling the version of all those assemblies at once?

We have a version like

major.minor.patch.revision

Most of the times on a release, just the minor version gets a change.

A critical part is the revision which is the fileversion in the repository. At the moment I think this makes impossible to use one AssemblyInfo.cs for all assemblies.

How can I avoid to change the AssemblyInfo.cs of all those assemblies?

Mare Infinitus
  • 8,024
  • 8
  • 64
  • 113
  • Do you have a build/release automation tool? Auto-incrementing a build number is trivial to add in [TeamCity](http://stackoverflow.com/questions/14276498/increment-the-build-number-automatically) or my company's product [BuildMaster](http://inedo.com/buildmaster) (specifically the Write Assembly Versions action). – Karl Harnagy Jul 10 '13 at 22:27
  • At the moment I do not use one. This seems to solve this problem. – Mare Infinitus Jul 11 '13 at 06:10
  • @KarlHarnagy Think this is the way to go. Can you please provide an answer to accept? – Mare Infinitus Jul 12 '13 at 17:59

2 Answers2

3

If you want all of the assemblies to have the same version, you can make a single .cs file for the versioning in one of your libraries, and add it as a link to the other projects.

This will cause the single file to be part of all three assemblies, and keep the version constant across them all.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • Thank you very much for your answer! What makes this impossible is the last part of the version, which is revision in the repository. This shall be the one from the repository, not one for all assemblies. – Mare Infinitus Jul 10 '13 at 22:02
  • @MareInfinitus Yeah - if you're doing that, then it's difficult. Post-build event, maybe? – Reed Copsey Jul 10 '13 at 22:05
1

I've found that this is easiest to do when you're going to create your build artifacts. From a process standpoint, you would: 1. Tag/Label Source 2. Get by Tag/Label 3. Edit AssemblyInfo files 4. Build, Test, Etc 5. Capture Build Artifact

This is all pretty easy to do in BuildMaster(disclaimer: I work for Inedo as a set of actions. In this case it'd be just using the Write Assembly Versions action after doing a Get Latest action.

You can see this pattern used a lot in the specifics libraries. When we build ProGet, for example, you'll notice that Write Assembly Versions shortly after comparing the directories for changings, and right before running msbuild.

Karl Harnagy
  • 717
  • 5
  • 10