This documentation is archived and is not being maintained.

Global Attributes in Managed Extensions for C++

Visual Studio .NET 2003

Assemblies are the building blocks of a managed application. One feature of assemblies is the ability to store extra information, called metadata. Metadata allows easier communication between components and can be modified by using global attributes.

In most cases, attributes apply to specific language elements in an assembly or module, such as classes or methods. However, some attributes are global, and they apply to an entire assembly or module. Global attributes can appear in multiple source files in a single compilation.

Assembly-level attributes are specified as follows:

[assembly:attribute];

Module-level attributes are specified as follows:

[module:attribute];

where:

attribute
An applicable global attribute.

The following .NET Framework attributes let you modify the information in an assembly:

  • System::Reflection::AssemblyConfigurationAttribute
  • System::Reflection::AssemblyCultureAttribute
  • System::Reflection::AssemblyDelaySignAttribute
  • System::Reflection::AssemblyDescriptionAttribute
  • System::Reflection::AssemblyKeyFileAttribute
  • System::Reflection::AssemblyKeyNameAttribute
  • System::Reflection::AssemblyTitleAttribute
  • System::Reflection::AssemblyVersionAttribute

Use the file created by Strong Name Utility (SN.exe) as the parameter to AssemblyKeyFileAttribute, AssemblyKeyNameAttribute, or AssemblyDelaySignAttribute to sign (or give a strong name to) your assembly.

To specify multiple assembly or module-level attributes in a single attribute block, separate each attribute by a comma. For instance, the following sample specifies two assembly-level attributes:

[assembly:System::CLSCompliant(true), assembly:System::Expando];
Note   In terms of assemblies, the default behavior of the /clr compiler option inserts an assembly manifest into the output file. If you do not want an assembly created for a compilation, use the compiler option /clr:noAssembly. For more information on assemblies, see Components and Assemblies.

Example

For an example of a global attribute, see Restricted Values for Version Number in Managed Applications.

See Also

Global Attributes | Assemblies, Attributes, and Metadata

Show: