C# Project Global AssemblyInfo

13,517

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

Share:
13,517
Petezah
Author by

Petezah

Updated on June 16, 2022

Comments

  • Petezah
    Petezah almost 2 years

    NET 3.5 solution with multiple projects in it. Is there a way I can create a "Global" AssemblyInfo.cs in which all the project AssemblyInfo.cs can reference from?

  • Petezah
    Petezah almost 14 years
    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
    Petezah almost 14 years
    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"
  • Yauheni Sivukha
    Yauheni Sivukha almost 14 years
    It's obvious - you have the same attribute in global and local AssemblyInfo file and compiler do not accept this!
  • D3vtr0n
    D3vtr0n about 13 years
    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.