What are the best practices for using Assembly Attributes?

We're using a global file called GlobalAssemblyInfo.cs and a local one called AssemblyInfo.cs. The global file contains the following attributes:

 [assembly: AssemblyProduct("Your Product Name")]

 [assembly: AssemblyCompany("Your Company")]
 [assembly: AssemblyCopyright("Copyright © 2008 ...")]
 [assembly: AssemblyTrademark("Your Trademark - if applicable")]

 #if DEBUG
 [assembly: AssemblyConfiguration("Debug")]
 #else
 [assembly: AssemblyConfiguration("Release")]
 #endif

 [assembly: AssemblyVersion("This is set by build process")]
 [assembly: AssemblyFileVersion("This is set by build process")]

The local AssemblyInfo.cs contains the following attributes:

 [assembly: AssemblyTitle("Your assembly title")]
 [assembly: AssemblyDescription("Your assembly description")]
 [assembly: AssemblyCulture("The culture - if not neutral")]

 [assembly: ComVisible(true/false)]

 // unique id per assembly
 [assembly: Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")]

You can add the GlobalAssemblyInfo.cs using the following procedure:

  • Select Add/Existing Item... in the context menu of the project
  • Select GlobalAssemblyInfo.cs
  • Expand the Add-Button by clicking on that little down-arrow on the right hand
  • Select "Add As Link" in the buttons drop down list

In my case, we're building a product for which we have a Visual Studio solution, with various components in their own projects. The common attributes go. In the solution, there are about 35 projects, and a common assembly info (CommonAssemblyInfo.cs), which has the following attributes:

[assembly: AssemblyCompany("Company")]
[assembly: AssemblyProduct("Product Name")]
[assembly: AssemblyCopyright("Copyright © 2007 Company")]
[assembly: AssemblyTrademark("Company")]

//This shows up as Product Version in Windows Explorer
//We make this the same for all files in a particular product version. And increment it globally for all projects.
//We then use this as the Product Version in installers as well (for example built using Wix).
[assembly: AssemblyInformationalVersion("0.9.2.0")]

The other attributes such as AssemblyTitle, AssemblyVersion etc, we supply on a per-assembly basis. When building an assembly both AssemblyInfo.cs and CommonAssemblyInfo.cs are built into each assembly. This gives us the best of both worlds where you may want to have some common attributes for all projects and specific values for some others.

Hope that helps.