This post demonstrates how to read .NET assembly name metadata.
Originally, I require to detect whether the target platform for any .NET assembly is built? After digging, I end up with creating a small Winform application which can display some Assembly name attributes.
Using the Code
This code can be utilized by firstly calling the
GetAssemblyName method in
AssemblyName class in
System.Reflection namespace (as shown below) and then fetching the different attributes of the assembly to be analyzed.
Read assembly metadata using reflection (
var assemblyInfo = AssemblyName.GetAssemblyName(textBoxAssemblyFilePath.Text);
var assemblyName = assemblyInfo.Name
var assemblyVersion = assemblyInfo.Version
var assemblyArchitecture = assemblyName.ProcessorArchitecture;
Using the Sample Application
To find the process architecture of the .NET Assembly, just download the sample application with this post and execute.
Select the assembly to analyse and click on 'Read Assembly Metadata'.
The description text box will show the metadata for which I have programmed. If required, you can do some more research to read other metadata associated with the assembly like - Culture Info, Signing information, private and public key information, etc. (See the screenshot below.)