I was dusting off my assembly knowledge the other day and was looking into an assembly manifest generated by Visual Studio. I generally think assembly manifests are a good idea, although they are not always needed- I think it was a great decision to make the optional in .NET Core.

I was aware in the back of my mind that there is a wealth of attributes to decorate your assembly with. A quick look at Intellisense confirmed this.

Screenshot_2

I wanted to find out more about different attributes but to my surprise, my Google searches did not yield a complete list. MSDN itself is fragmented but you can only find out about assembly attributes in the same manner as any other class: categorisation is by namespace.

Attributes span three namespaces:

  1. System.Reflection (the most common atttributes and the ones Visual Studio generated by default)
  2. System.Runtime.InteropServices
  3. System.Runtime.CompilerServices

Even within this scope, attributes are mixed in with other members, like in System.Runtime.InteropServices. Since the AssemblyInfo.cs is like any other C# file, you can define namespaces and classes and of course run any sort of code you want to. As a result, Intellisense presents a list of attributes that are only meaninful when applied on a method, and it is not always clear from the documentation what these are.

For the purposes of this post I am only interested in attributes relevant on assembly level, i.e. they are either generated metadata or fullfil some other function for the assembly as a whole.

So, here is a somewhat consice list of those attributes, starting with System.Reflection

System.Reflection
AssemblyAlgorithmAttribute: Specifies which hashing algorithm to use when reading hash values in the assembly manifest.
AssemblyCompanyAttribyte: Can be used to specify the company that produced the assembly.
AssemblyConfigurationAttribute: Specifies which configuration is used for the assembly such as DEBUG or RELEASE.
AssemblyCopyrightAttribyte: Specifies the copyright information of the assembly
AssemblyCultureAttribute: Used by the compiler to distinguish between a main and satellite assembly.
AssemblyDefaultAliasAttribute: Can be used to specify a readable default alias if the assembly name is a GUID or similar
AssemblyDelaySignAttribute: Specifies that the assembly will be signed after compilation but will be marked as strongly named.
AssemblyDescriptionAttribute: Can be used to specify a description of the assembly
AssemblyFileVersionAttribute: The version of the assembly when viewed in the Properties window of the dll that contains it.
AssemblyFlagsAttribute: Can be used to specify a number of [AssemblyNameFlags] values.
AssemblyInformationalVersionAttribute: Attached additional version information to an assembly.
AssemblyKeyFileAttribute: Specifies a path to a key file to use to sign the assembly.
AssemblyKeyNameAttribute When building a strong-named assembly, the author can supply either this attribute or [AssemblyKeyFileAttribute]
AssemblyMetaDataAttribute: Defines a key/value metadata pair for the decorated assembly.
AssemblyName: Describes an assembly's unique identity in full.
AssemblyNameFlags: Provides information about an assembly reference.
AssemblyNameProxy: Provides a remotable version of the [AssemblyName]
AssemblyProductAttribute: Defines a product custom name attribute for an assembly manifest.
AssemblySignatureKeyAttribute Provides migration from an older, simpler strong name key to a larger key with a stronger hashing algorithm.
AssemblyTitleAttribute Specifies a description for an assembly.
AssemblyTrademarkAttribute: Defines a trademark custom attribute for an assembly manifest.
AssemblyVersionAttribute: Specifies the version of the assembly being attributed.
[ObfuscateAssembly] (https://docs.microsoft.com/en-us/dotnet/api/system.reflection.obfuscateassemblyattribute?view=netframework-4.8) Instructs obfuscation tools to use their standard obfuscation rules for the appropriate assembly type.
[Obfuscation] (https://docs.microsoft.com/en-us/dotnet/api/system.reflection.obfuscationattribute?view=netframework-4.8) Instructs obfuscation tools to take the specified actions for an assembly, type, or member.

The other two namespaces will follow in separate posts.