Multiple project, single assemblies version manager

Viewed 116

I have a solution that includes about 70 projects, each with its individual version (We are following the Version pattern).

We would like to manage the assemblies versions in a single file, something like a CommonAssembliesVersions.cs file as suggested in other questions/answers.

The only problem is that by doing so we are giving to each assembly the same version. Is possible to specify what version to assign to which assembly? something like

[assembly "AssemblyName1":AssemblyVersion("0.0.1.1")]
[assembly "AssemblyName2":AssemblyVersion("1.2.4.1")]
[assembly "AssemblyName3":AssemblyVersion("4.0.54.3001")]

and so on?

1 Answers

Using @rene's idea, setup a common AssemblyInfo as described here or elsewhere. Inside each project, define a conditional compilation symbol for the assembly name.

Then, inside your SharedAssemlyInfo.cs you could do this:

#if AssemblyName1
[assembly: AssemblyVersion("0.0.1.1")]
#elif AssemblyName2
[assembly: AssemblyVersion("1.2.4.1")]
#elif AssemblyName3
[assembly: AssemblyVersion("4.0.54.3001")]
#endif
Related