"Combat Learning C #" to set the version and Help information for a program

Source: Internet
Author: User

1 Practical Instructions

We often use a computer software to see its version, company and author information. As shown in 1. So how do we set the version and Help information for the software? We demonstrate with Visual Studio 2015 as an example.

2 Preliminary knowledge

The software's information is primarily set up in the AssemblyInfo.cs assembly.

2.1 Configuring AssemblyInfo Files by code

A file named AssemblyInfo.cs is automatically generated under the Properties folder of the. NET project and contains some property tags, such as version information. In general, we seldom change the file directly.

When clicked, the following code appears, as shown below.

1 usingSystem.Reflection;2 usingSystem.Runtime.CompilerServices;3 usingSystem.Runtime.InteropServices;4 5 //General information about assemblies is provided by the following6 //control. Changing these attribute values can be modified7 //the information associated with the assembly. 8[Assembly:assemblytitle ("Setassemblyinfo")]9[Assembly:assemblydescription ("")]Ten[Assembly:assemblyconfiguration ("")] One[Assembly:assemblycompany ("")] A[Assembly:assemblyproduct ("Setassemblyinfo")] -[Assembly:assemblycopyright ("Copyright? .")] -[Assembly:assemblytrademark ("")] the[Assembly:assemblyculture ("")] -  - //setting ComVisible to False causes the types in this Assembly - //not visible to COM components. If you need to access the types in this assembly from COM, + //Please set this type of ComVisible attribute to true.  -[Assembly:comvisible (false)] +  A //If this item is exposed to COM, the following GUID is used for the ID of the type library at[Assembly:guid ("F4f0aad3-3856-4deb-bff1-f4003bbe5a24")] -  - //The version information for an assembly consists of the following four values: - // - //Major Version - //Minor version in //Build Number - //Revision number to // + //you can specify all of these values, or you can use the default values for the build number and revision number, - //the method is to use "*" as follows : the //[Assembly:assemblyversion ("1.0.*")] *[Assembly:assemblyversion ("1.0.0.0")] $[Assembly:assemblyfileversion ("1.0.0.0")]

2.1.1 Assemblytitle Properties

This property defines the assembly title. The syntax of its constructor is as follows:

 Public AssemblyTitleAttribute (string title);

It can be seen that it contains only a string parameter, the title, which modifies the Assembly's caption.

2.1.2 Assemblydescription Properties

This property defines the description of the assembly. The syntax of its constructor is as follows:

   Public AssemblyDescriptionAttribute (string description);

Contains only one string parameter, description, if the description of the assembly is added by modifying the parameter implementation.

2.1.3 Assemblyconfiguration Properties

This property defines the configuration information for the assembly, such as retail, publishing, debugging, and so on. The NET runtime does not use this property. The syntax of its constructor is as follows:

 Public AssemblyConfigurationAttribute (string configuration);

2.1.4 Assemblycompany

This property defines the company information for the Assembly.

2.1.5 Assemblyproduct

This property defines the product name of the assembly.

2.1.6 Assemblycopyright

This property defines the copyright information for the assembly.

2.1.7 Assemblytrademark

This property defines the trademark information for the Assembly.

2.1.8 AssemblyVersion

Defines the version information for an assembly. , the version number consists of 4 values, namely: major, minor, build, and revision.

From the above, we can achieve the desired setting effect by modifying these property values within the AssemblyInfo.

2.2 Complete Setup with a fool-type operation

We actually manipulate the file in another form. That is to go to "application", "assembly Information", and then modify the information by right-clicking on the item's properties. As shown in.

3 references

1200 cases of development in C #

Visual C # from getting started to mastering

"Combat Learning C #" to set the version and Help information for a program

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.