0

I have some solution that contain in it 20 project ( dll ) and one main project ( exe )

the .exe project have some version number (A.B.C.D) and i want to update all the all in the solution with the same version number as the .exe

Is there any way to update all the project in the solution with the same version id ?

Yanshof
  • 9,659
  • 21
  • 95
  • 195
  • How are you building this solution? TeamCity has a feature called assembly patching that will write whatever number (usually build number) into the assemblies without committing that to your source tree. – Fran Jun 20 '17 at 17:26

2 Answers2

5

You could use a "shared assembly info". We're using this concept in several of our solutions.

Just a few hints (for more details see the linked blog post below):

  • Add a SharedAssemblyInfo.cs as a solution item
  • This shared file contains all the information that the projects have in common: e.g. version number, company name, ...
  • Add this file as a link to the projects
  • Delete attributes that would now be doubled from the individual assembly info files

https://blogs.msdn.microsoft.com/jjameson/2009/04/03/shared-assembly-info-in-visual-studio-projects/

Jan Köhler
  • 5,817
  • 5
  • 26
  • 35
2

Create a solution folder, add a cs file (name does not matter, for example SolutionAssemblyInfo.cs), which just contains the line with the version:

[assembly: AssemblyVersion("2.0.*")]

Then remove this line from all AssemblyInfo.cs files of all projects. Then link the SolutionAssemblyInfo.cs file into each project (hold the alt key while dragging).

Cee McSharpface
  • 8,493
  • 3
  • 36
  • 77
  • Due to seconds difference in build time, this will yield different results for different projects. ProjectA: 2.0.1111.1112 ProjectB: 2.0.1111.1113 – Luishg Nov 22 '21 at 12:49