配置文件AssemblyInfo.cs主要用来设定生成的有关程序集的常规信息dll文件的一些参数,下面是默认的AssemblyInfo.cs文件的内容具体介绍
//是否符合公共语言规范(CLS)
[assembly: CLSCompliant(true) ]
//控制程序集中所有类型对COM的可访问性
[assembly: ComVisible(false)]
//代码的作者和这些代码的的开发人员之间的可靠协定
[assembly: ReliabilityContract(Consistency.WillNotCorruptState,Cer.MayFail)]
//标题:
[assembly: AssemblyTitle(".NET Pet Shop Model")]
//备注:
[assembly: AssemblyDescription(".NET Pet Shop Middle-Tier Components")]
//配置文件:
[assembly: AssemblyConfiguration("")]
//公司:
[assembly: AssemblyCompany("Microsoft Corporation")]
//产品名称:
[assembly: AssemblyProduct(".NET Pet Shop 4.0")]
//版权:
[assembly: AssemblyCopyright("Copyright ?2005 Microsoft Corporation")]
//商标声明:
[assembly: AssemblyTrademark("")]
//内部名称
[assembly: AssemblyCulture("")]
具体解释如下:
1. [assembly: AssemblyTitle("")]
[assembly: AssemblyTitle("")]代码中”:”好前面的assembly表示此属性在程序集范围内发生作用。
类型名:System.Reflection.AssemblyTitleAttribute
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyTitleAttribute : Attribute
此属性描述程序集的名称,如:某某公司某某项目某某模块等,此名称可以是任何合法的字符串,可以有空格。
2. [assembly: AssemblyDescription("")]
类型名:
System.Reflection.AssemblyDescriptionAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyDescriptionAttribute : Attribute
功能:
程序集的简单描述,如功能、语言等
3. [assembly: AssemblyDescription("")]
类型名:
System.Reflection.AssemblyDescriptionAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyDescriptionAttribute : Attribute
功能:
程序集的简单说明,描述程序集的功能、特性、约束等
4. [assembly: AssemblyConfiguration("")]
类型名:
System.Reflection.AssemblyConfigurationAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyConfigurationAttribute : Attribute
功能:
程序集的配置信息,如:零售、发布、调试等,.NET运行时没有使用此属性
5. [assembly: AssemblyCompany("")]
类型名:
System.Reflection.AssemblyCompanyAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyCompanyAttribute : Attribute
功能:
程序集所属的公司名称
6. [assembly: AssemblyProduct("")]
类型名:
System.Reflection.AssemblyProductAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyProductAttribute : Attribute
功能:
程序集所述的产品名
7. [assembly: AssemblyCopyright("")]
类型名:
System.Reflection.AssemblyCopyrightAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyCopyrightAttribute : Attribute
功能:
程序集的版权信息
8. [assembly: AssemblyTrademark("")]
类型名:
System.Reflection.AssemblyTrademarkAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyTrademarkAttribute : Attribute
功能:
程序集的商标信息
9. [assembly: AssemblyCulture("")]
类型名:
System.Reflection.AssemblyCultureAttribute
Attribute声明:
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AssemblyCultureAttribute : Attribute
功能:
枚举的字段表明程序集支持的区域性。程序集也可以指定区域独立性,表明它包含用于默认区域性的资源。运行库将任何区域性属性未设为空的程序集按附属程序集处理。此类程序集受附属程序集绑定规则约束。详细信息,请参见运行库如何定位程序集。
补充个简单的例子:
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过下列属性集 // 控制。更改这些属性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("MobileManager.DAL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("accp")] [assembly: AssemblyProduct("MobileManager.DAL")] [assembly: AssemblyCopyright("Copyright © accp 2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 属性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("d5e142a8-2668-4536-82f4-93f47c56f001")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 内部版本号 // 修订号 // // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
博客来源:
http://www.cnblogs.com/scy251147/archive/2010/10/23/1859576.html