How to synchronize versions between Visual C # projects?

I have three projects in my solution: the base project, as well as the client and server that reference the base.

What I would like to do is install the base version of the project file assembly and automatically distribute it to the server and client so that their versions always match. Ideally, this would be a preliminary step for synchronizing them.

Does anyone know if this is possible or how I will do it?

+7
source share
2 answers

What we do is very similar to Chris's answer:

We have a project called ProductVersion , where "Product" is actually the name of the product. Inside is a static class called VersionInformation that contains constant lines, including one called ProductVersion , where we actually set the version information.

Then, in each AssemblyInfo.cs project file, our AssemblyVersion line looks like this:

 [assembly: AssemblyVersion(Company.Product.VersionInformation.ProductVersion)] 

In your case, since both the client and server refer to the base project, you can simply add something like this to the base project instead of creating a separate project.

+7
source

Move the version information to a separate file (for example, AssemblyVersion.cs) in the root directory of the solution. Then, remove the version information from each AssemblyInfo.cs file of the project and add the shared AssemblyVersion file to each project as a reference.

  • Right-click on the project, select Add Existing Item
  • Go to the shared file, click the small arrow on the add button and select Add as link
  • Drag the resulting file into the Properties folder in each project.
  • ???
  • Profit!
+5
source

All Articles