Rob Smyth

Wednesday 3 December 2008


Visual Studio creates an AssemblyInfo.cs file for each project in a solution in a 'Properties' folder. Thing is that, more often than not, I'm more interesting in an application's version than the individual assembly's version, and the solution is the application. So I find that each time I create solution with multiple projects (assemblies) I add a 'Common' project that has an AssemblyInfo.cs file to be used by all other projects. That way all assemblies have the same version information.

To do this delete the AssemblyInfo.cs file in each project and then 'Add Existing item' browse to the common AssemblyInfo.cs and add as link. This way all projects share the same AssemblyInfo.cs file. Unfortunately Visual Studio does not allow adding any items to the 'Properties' folder.

Good way to go even if the AssemblyInfo.cs file is manually updated or created/updated automatically.

1 comment:

Unknown said...

Interesting, I've been doing something similar with my team that you may find useful.

For each .Net Project within a Product we have only the following attributes in each AssemblyInfo.cs:

AssemblyTitle, AssemblyDescription, ComVisible, Guid, AssemblyVersion, and AssemblyFileVersion

At the solution level is a file called GlobalAssemblyInfo.cs that contains the following attributes:

AssemblyCompany, AssemblyProduct, AssemblyCopyright, AssemblyTrademark, AssemblyCulture, AssemblyInformationalVersion

And the following just helps keep tabs on the state of a deployment when someone is troubleshooting:
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyConfiguration("Release")]

As I'm sure you've gathered, all Projects link to the GlobalAssemblyInfo.cs file. Each individual project's AssemblyInfo.cs and the link to GlobalAssemblyInfo.cs are moved into the Properties folder. No, you can't add files directly to it from the context menu but you can drag and drop files into it.

Works great for us; all assemblies have all of the correct company and copyright info as well as product version and each component has its own individual info and version.