Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change assembly version for multiple projects

How can I change the assembly version in the file AssemblyInfo.cs for multiple projects. We have around 75 project in our solution and we need to change the version almost every week. What is the fastest way to do this.

like image 233
Ramesh Soni Avatar asked Jun 11 '09 12:06

Ramesh Soni


People also ask

What is the difference between assembly version and assembly file version?

AssemblyVersion: Specifies the version of the assembly being attributed. AssemblyFileVersion: Instructs a compiler to use a specific version number for the Win32 file version resource.

What is the Sharedassemblyinfo CS?

A Shared assembly info file is a normal file same as our AssemblyInfo. cs or AssemblyInfo. vb file and contains attributes that will be shared across projects in a particular solution.

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 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".


2 Answers

I usually create a file called AssemblyVersionInfo.cs that is included as a link in all projects. I make this file contain the version attributes, and remove the same attributes from the regular AssemblyInfo.cs files. Then you can update version numbers in one file only, and make all the projects share the same number.

To add the file as a link; right click the project in the solution explorer, select "Add" -> "Existing item...". Browse to the file, and then click the little arrow in the right edge of the add button, and select "Add As Link" in the dropdown menu.

like image 83
Fredrik Mörk Avatar answered Sep 18 '22 14:09

Fredrik Mörk


One way to do it is to have a master build script that uses the AssemblyInfo Task to set the version number at build time(http://code.msdn.microsoft.com/AssemblyInfoTaskvers) and then define the versions numbers as properties in the msbuild script.

like image 43
pjbelf Avatar answered Sep 17 '22 14:09

pjbelf