In a typical .NET app, product and version information are stored in the AssemblyInfo.cs
file under the 'Properties' folder, like so...
DLL Project
- Properties Folder
- AssemblyInfo.cs
In our case, we have a solution where we need to keep version information synced across eleven DLLs.
To accomplish this, we first removed any shared values from each project's AssemblyInfo.cs
file, leaving only those values specific to that particular project.
We then placed all of the shared values in a second file called AssemblyInfo_Shared.cs
which we store in a sibling folder to those of the projects. We then add that file to each project's 'Properties' folder via a link (that's the little 'down' arrow on the button when you're adding it.)
By doing this, all related DLLs share the same version information while still retaining assembly-specific properties as well. It makes keeping a set of versioned DLLs in sync a piece of cake as we edit a single file and all eleven DLLs' versions update at once.
Here's what it looks like...
Common Folder
- AssemblyInfo_Shared.cs (Actual)
DLL Project A
- Properties Folder
- AssemblyInfo.cs // Only values specific to A
- AssemblyInfo_Shared.cs (Link)
DLL Project B
- Properties Folder
- AssemblyInfo.cs // Only values specific to B
- AssemblyInfo_Shared.cs (Link)
The contents of AssemblyInfo.cs in Project A looks like this...
using System.Reflection;
[assembly: AssemblyTitle("SomeApp.LibA")]
[assembly: AssemblyDescription("This is the code for A")]
This is project B's
using System.Reflection;
[assembly: AssemblyTitle("SomeApp.LibB")]
[assembly: AssemblyDescription("This is the code for Project B")]
And here's the shared...
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("SomeApp")]
[assembly: AssemblyVersion("1.4.3.0")]
[assembly: AssemblyFileVersion("1.4.3.0")]
[assembly: AssemblyCompany("MyCo")]
[assembly: AssemblyCopyright("Copyright (c) 2010-2018, MyCo")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
With the above, both DLLs share the same version information since the common file is 'merged' with the project-specific one when building. Hope this makes sense.
However, in .NET Standard projects, it looks like the version information is baked right into the Project file under the <PropertyGroup>
section, so I'm not sure how we can achieve the same capability.
Does .NET Standard have anything that supports this?