What is an assembly's manifest, and what identity information does it contain?
Short answer
The assembly manifest is metadata embedded within every assembly describing its identity: name, version number, optional culture (for localization), and a list of the other assemblies it references along with their required versions -- the CLR uses this manifest during assembly…
Advertisement
AModel answer
The assembly manifest is metadata embedded within every assembly describing its identity: name, version number, optional culture (for localization), and a list of the other assemblies it references along with their required versions -- the CLR uses this manifest during assembly loading to resolve dependencies and verify version compatibility.
using System.Reflection;
var assembly = Assembly.GetExecutingAssembly();
var name = assembly.GetName();
Console.WriteLine($"{name.Name} v{name.Version}");
foreach (var refAssembly in assembly.GetReferencedAssemblies())
Console.WriteLine(refAssembly.FullName);Real-world example
A diagnostic tool prints every loaded assembly's manifest information at application startup to help troubleshoot a version-mismatch issue where two different versions of the same dependency were accidentally loaded.
Likely follow-ups
- How does the CLR resolve which version of a referenced assembly to actually load?
- What's the difference between the assembly name and its strong name?
Related topics