问:使用程序集属性的最佳做法是什么? [英] What are the best practices for using Assembly Attributes?

查看:180
本文介绍了问:使用程序集属性的最佳做法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个项目的解决方案。我试图通过连接一个解决方案广集信息文件,以优化的AssemblyInfo.cs文件。什么是这样做的最佳做法?哪些属性应该在广泛的解决方案和文件,这是项目/组件特定的?

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 this? Which attributes should be in solution wide file and which are project/assembly specific?


编辑:如果你有兴趣有一个跟进的问题<一href=\"http://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin\">What是的AssemblyVersion,和的AssemblyFileVersion AssemblyInformationalVersion?

推荐答案

我们正在使用一个全局文件名为GlobalAssemblyInfo.cs和当地一个叫AssemblyInfo.cs中。全局文件包含以下属性:

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")]

本地的AssemblyInfo.cs包含下列属性:

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")]

您可以使用以下步骤添加GlobalAssemblyInfo.cs:

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


  • 选择添加/现有项... 在项目的上下文菜单

  • 选择GlobalAssemblyInfo.cs

  • 通过点击那个小向下箭头在右边展开附加按钮

  • 选择添加链接中的按钮下拉列表

  • 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

这篇关于问:使用程序集属性的最佳做法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆