16

I've got a solution with multiple .NET 3.5 projects.
Is there a way I can create a "global" AssemblyInfo.cs so that all project AssemblyInfo.cs files can reference from?

Jan Schultke
  • 17,446
  • 6
  • 47
  • 96
Petezah
  • 1,465
  • 4
  • 26
  • 30

1 Answers1

42

Create AssemblyInfoInc.cs somewhere in the root of your solution, add global attributes there and add as link to each project.

File Add Dialog:

Adding global assembly info

Yauheni Sivukha
  • 2,586
  • 20
  • 22
  • I tried following your instructions but I got the following error: "Error 28 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type" when trying to call my global AssemblyInfo.cs in the project AssemblyInfo. – Petezah Apr 28 '10 at 18:59
  • I actually have a new error now. I put the following into the root of my solution: "using System.Reflection; [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]" and I got the following errors: "Error 2 Duplicate 'AssemblyFileVersion' attribute Error 1 Duplicate 'AssemblyVersion' attribute" – Petezah Apr 28 '10 at 20:01
  • 1
    It's obvious - you have the same attribute in global and local AssemblyInfo file and compiler do not accept this! – Yauheni Sivukha Apr 29 '10 at 05:21
  • 1
    I just used this and it works. One thing to point out is that by linking these, you can use both the local project level AssemblyInfo and the Global, solution level AssemblyInfo together. You cannot have the same attributes in each file, they must be unique. This approach works quite well, even though I had my doubts about doubling the AssemblyInfo attributes, it seems to work nice. – D3vtr0n Mar 23 '11 at 16:58