What are the best practices for using Assembly Attributes?

后端 未结 8 1267
北荒
北荒 2020-12-12 09:16

I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing

8条回答
  •  青春惊慌失措
    2020-12-12 09:27

    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

提交回复
热议问题