AssemblyInfo. cs file details, assemblyinfo. cs

Source: Internet
Author: User

AssemblyInfo. cs file details, assemblyinfo. cs

1. A file named AssemblyInfo. cs is automatically generated in the Properties folder of the. Net project. In general, this file is rarely directly modified. But we actually operate the file in another form. Right-click the properties of the project to go to "application"> "assembly information", and modify the information.

2. Set the general information of the Assembly (dll file) through the Attribute for viewing or being used internally as the configuration information.

The content of this file is as follows:

1 // assembly Title 2 [assembly: AssemblyTitle ("assembly title")] 3 // assembly description 4 [assembly: AssemblyDescription ("assembly description")] 5 // product name 6 [assembly: AssemblyProduct ("Product Name")] 7 // company 8 [assembly: AssemblyCompany ("company name")] 9 // valid trademark 10 [assembly: AssemblyTrademark ("Legal trademark")] 11 // specify the Region 12 supported by the assembly [assembly: AssemblyCulture ("regional")] 13 // Copyright 14 [assembly: AssemblyCopyright ("Copyright 2014")] 15 // configuration file, such as retail, publishing, debugging, and other information. The assembly does not use this information at runtime. 16 [assembly: AssemblyConfiguration ("")] 17 // The assembly version information consists of the following four values: 18 // 19 // main version 20 // times 21 // internal version 22 // revision 23 // 24 // all these values can be specified, you can also use the default values of "internal version number" and "revision number". 25 // use "*": 26 [assembly: AssemblyVersion ("1.0.0.0")] as follows: 27 28 // control the accessibility to COM for all types of datasets 29 [assembly: ComVisible (false)] 30 // if this project is made public to COM, then the following GUID is used for ID31 [assembly: Guid ("77bf07c6-941f-4ba7-b95d-6a5c18401f74")]

3. Right-click the generated dll file and click Properties to view the above information.

Assembly: indicates that the feature uses an assembly as its scope of action.

4. Read Assembly features

Take the example of reading [assembly: AssemblyProduct ("")]

Type t = typeof(Program);AssemblyProductAttribute productAttr = t.Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0] as AssemblyProductAttribute;Console.WriteLine(productAttr.Product);

5. Important Points

1) [assembly: AssemblyProduct ("")] is not limited to use in the AssemblyInfo. cs file, but can be used in any. cs file.

2) for the same feature, you can set it only once in the Assembly; otherwise, an error will be reported during compilation.

Example:

[assembly:AssemblyProduct("")]namespace{  public class Demo{  }}

 

Reprinted link: https://www.cnblogs.com/fsjohnhuang/p/3992258.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.