What are the best practices for using Assembly Attributes?

后端 未结 8 1275
北荒
北荒 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:18

    The solution presented by @JRoppert is almost the same as what I do. The only difference is that I put the following lines in the local AssemblyInfo.cs file as they can vary with each assembly:

    #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")]
    [assembly: CLSCompliant(true)]
    

    I also (generally) use one common assembly info per solution, with the assumption that one solution is a single product line/releasable product. The common assembly info file also has:

    [assembly: AssemblyInformationalVersion("0.9.2.0")]
    

    Which will set the "ProductVersion" value displayed by Windows Explorer.

提交回复
热议问题