Assembly Attributes in .NET Framework

Assemblies have built-in attributes that are very helpful during our Assembly interrogation. In addition, we can add our own attributes to describe Assemblies even further.

[Aassembly: AssemblyCompany("Proseware, Inc.")]

Here is a list of built in Attributes and their usage with in .NET Framework. All examples are written in C#. Keep in mind that in order to implement attribute, you need to remove “Attribute” keyword from the class.

AssemblyAlgorithmIdAttribute Class implements AssemblyAlgorithmId attribute which is used to discover type of Hash algorithm used for the reading of assembly.

[assembly: AssemblyAlgorithmId(AssemblyHashAlgorithm.MD5)]

AssemblyCompanyAttribute Class implements AssemblyCompany attribute which is used producer of the Assembly. It is normally a company name.

[assembly: AssemblyCompany("Proseware, Inc.")]

AssemblyConfigurationAttribute Class implements AssemblyConfiguration attribute is used to specify “DEBUG” and “RELEASE” configuration information.

[assembly: AssemblyConfiguration("DEBUG")]

AssemblyCopyrightAttribute Class implements AssemblyCopyright attribute where we can find copyright information.

[assembly: AssemblyCopyright("Copyright © Proseware, Inc. 2006")]

AssemblyCultureAttribute Class implements AssemblyCulture attribute which is used to specify culture of an assembly as well as indicte that this is not a main assembly but rather its satellite.

[assembly: AssemblyCulture("de")] // German

AssemblyDefaultAliasAttribute Class implements AssemblyDefaultAlias attribute which is used for simplification of the name of the assembly.

[assembly: AssemblyDefaultAlias("DataLayer")]

AssemblyDelaySignAttribute Class implements AssemblyDelaySign attribute which is used to specify that the assembly will be signed or strongly named after compilation.

[assembly: AssemblyDelaySign(true)]

AssemblyDescriptionAttribute Class implements AssemblyDescription attribute which is used to annotate assembly for easy understanding.

[assembly: AssemblyDescription("This the Data Access Layer")]

AssemblyFileVersionAttribute Class implements AssemblyFileVersion attribute which is used to specify the file version of the assembly.

[assembly: AssemblyFileVersion("1.0.0.0")]

AssemblyFlagsAttribute Class implements AssemblyFlags attribute with the following list of flags

 

NameDescription
EnableJITcompileOptimizer Enables compiler optimization
EnableJITcompileTracking Enables compiler tracking
None No flags
PublicKey Enables creation of the public key
Retargetable Makes the assembly to be retargeted

[assembly: AssemblyFlags(AssemblyNameFlags.EnableJITcompileOptimizer | AssemblyNameFlags.EnableJITcompileTracking)]

AssemblyInformationalVersionAttribute Class implements AssemblyInformationalVersion attribute which is used for version specification.

[assembly: AssemblyInformationalVersion("1.0.0.1")]

AssemblyKeyFileAttribute Class implements AssemblyKeyFile attribute which specifies the path to a key file which is used to sign the assembly.

[assembly: AssemblyKeyFile("../key.snk")]

AssemblyTitleAttribute Class implements AssemblyTitle attribute which is used to specify title.

[assembly: AssemblyTitle("Proseware.Framework.DataLayer")]

AssemblyTrademarkAttribute Class implements AssemblyTrademark attribute which is used to specify trademark information.

[assembly: AssemblyTrademark("Proseware®")]

AssemblyVersionAttribute Class implements AssemblyVersion attribute which is used to specify version of the assembly in the form of <major version>.<minor version>.<build number>.<revision> * can be used to generate random number.

[assembly: AssemblyVersion("1.2.*.*")]