Let’s suppose we have a solution (LibrarySolution), with 2 projects:
- a class library for the data (DataLayer project)
- a WPF user interface (LibraryUI project).
Each of these projects have their own assembly info, as shown below.
The issues is that each time the version number is changed in one of the projects, you have to manually change it in the other project as well. This maybe wouldn’t be such a burdain if there were only 2 projects and the same person would be responsible to update them. But when you have multiple projects or multiple people updating the versions and they are not aware of the necesairy update, then you have a big problem.
The solution would be to create a class library to keep the common version info – and this way you have to change it only once and it will change in all the places that it is referenced.
This new project (AssemblyData) doesn’t need any classes, just place the common assemblyInfo data that you want to use in multiple .net projects from this solution.
Now, in every project that you want to use this version you have to:
- Add a reference to the AssemblyData project
- Add an “existing file” link to the AssemblyInfo.cs file from the AssemblyData project
- Remove the common assembly data from the project, and specify it only in the AssemblyData project
Now if we build the solution and change the version number in the AssemblyInfo.cs file from AssemblyData project, we will have the same version for both DataLayer and LibraryUI projects