Assembly Attributes

I l @ ve RuBoard

Every assembly contains various attributes, including the assembly name , company, version, culture, copyright, and description among others. Listing 5.1.3 shows the default AssemblyInfo.cs file included in every C# .NET project.

Listing 5.1.3 AssemblyInfo.cs
 1: using System.Reflection;  2: using System.Runtime.CompilerServices;  3:  4: //  5: // General Information about an assembly is controlled through the following  6: // set of attributes. Change these attribute values to modify the information  7: // associated with an assembly.  8: //  9: [assembly: AssemblyTitle("")] 10: [assembly: AssemblyDescription("")] 11: [assembly: AssemblyConfiguration("")] 12: [assembly: AssemblyCompany("")] 13: [assembly: AssemblyProduct("")] 14: [assembly: AssemblyCopyright("")] 15: [assembly: AssemblyTrademark("")] 16: [assembly: AssemblyCulture("")] 17: 18: // 19: // Version information for an assembly consists of the following four values: 20: // 21: //      Major Version 22: //      Minor Version 23: //      Build Number 24: //      Revision 25: // 26: // You can specify all the values or you can default the Revision and Build Numbers 27: // by using the '*' as shown below: 28: 29: [assembly: AssemblyVersion("1.0.*")] 30: 31: // 32: // In order to sign your assembly you must specify a key to use. Refer to the 33: // Microsoft .NET Framework documentation for more information on assembly signing. 34: // 35: // Use the attributes below to control which key is used for signing. 36: // 37: // Notes: 38: //   (*) If no key is specified - the assembly cannot be signed. 39: //   (*) KeyName refers to a key that has been installed in the Crypto Service 40: //       Provider (CSP) on your machine. 41: //   (*) If the key file and a key name attributes are both specified, the 42: //       following processing occurs: 43: //       (1) If the KeyName can be found in the CSP - that key is used. 44: //       (2) If the KeyName does not exist and the KeyFile does exist, the key 45: //           in the file is installed into the CSP and used. 46: //   (*) Delay Signing is an advanced option  see the Microsoft .NET Framework 47: //       documentation for more information on this. 48: // 49: [assembly: AssemblyDelaySign(false)] 50: [assembly: AssemblyKeyFile("")] 51: [assembly: AssemblyKeyName("")] 

The attributes for signing an assembly ( AssemblyDelySign , AssemblyKeyFile and AssemblyKeyName ) are covered in Chapter 5.2. The rest of the attributes should be somewhat familiar to Win32 developers. Every assembly can have information about the company that produced the assembly, including copyright information and current version.

I l @ ve RuBoard


C# and the .NET Framework. The C++ Perspective
C# and the .NET Framework
ISBN: 067232153X
EAN: 2147483647
Year: 2001
Pages: 204

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net