Same Assembly Version For All Project
A question I was asked today was how to manage the same Assembly Version for several project I.e. have it managed in one place.
There are several way to accomplish this task... the most simple is as follows:
1 Delete the AssemblyVersion and AssemblyFileVersion attributes from the AssemblyInfo.cs file in all the target projects. ( this will remove duplication conflicts)
2. Create a new file to host the version (I've called it FileVersion.cs in this sample) and pate the following code into the new text file:
using System.Reflection;
// Set here the global file version
[assembly: AssemblyVersion("1.2.3.4")]
[assembly: AssemblyFileVersion("1.2.3.4")]
3. Here comes the tricky part... in each of your target projects you would want to add a link to the existing file, note on the word link and not just adding an existing file which will add a copy of the FileVersion.cs file to your project.
In order to add an existing file as link open the Add Existing File Dialog Box (Right Click on the project -> Add -> Existing Item) then choose the file (FileVersion.cs) and before hitting the Add button click on the small arrow on this button and choose add as link.
[ Click on the picture above to see it in large ]
4. Thats it... you have one place to maintain the file version.