Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating the version number of all assemblies in a solution

I've got a rather large solution in Visual Studio. Is there a way to update the Major / Minor version numbers for all the assemblies in the solution in one go?

like image 236
PaulB Avatar asked Apr 17 '09 09:04

PaulB


People also ask

What is assembly versioning explain with example?

Assembly informational versionThe text-based informational version corresponds to the product's marketing literature, packaging, or product name and is not used by the runtime. For example, an informational version could be "Common Language Runtime version 1.0" or "NET Control SP 2".

Where do I put assembly version?

You can set the assembly version using the AssemblyVersionAttribute. Assembly attributes are usually applied in the AssemblyInfo.

What is assembly version and assembly file version?

It's the version number used by framework during build and at runtime to locate, link, and load the assemblies. When you add reference to any assembly in your project, it's this version number that gets embedded.


2 Answers

You can share an AssemblyInfo.cs file between all projects in the solution. This shared file should contain the version numbers. To share it, you must use Add Existing File in VS and select Add as Link in the file dialog. Every project has its private and the shared AssemblyInfo.cs. The private one still contains the non-Version attributes.

I've got a TeamCity setup, where I'm generating the shared file in each TeamCity build using the actual build version and it works beautifully.

like image 194
grover Avatar answered Oct 05 '22 13:10

grover


We have a single AssemblyInfoCommon.cs which has the version numbers, and is included in each project by reference. The other AssemblyInfo.cs files remain but only contain the assembly-specific information (title and description). So we only have one file to update for every C# project.

like image 26
marijne Avatar answered Oct 05 '22 15:10

marijne