Class AssemblyInfo
Represents basic information about a PE file representing an assembly.
Inherited Members
Namespace: Alphaleonis.Reflection.Metadata
Assembly: Alphaleonis.Reflection.Metadata.dll
Syntax
public sealed class AssemblyInfo
Remarks
The information provided by this class is usually retrieved using ReflectionOnlyLoad(String) and then examining the returned Assembly object. This however has the drawback that it is not possible to unload the assembly without performing the operation in a separate AppDomain.
This class retrieves basic information about the assembly only, via the MetadataReader provided in System.Reflection.Metadata, so the targetted assembly is not loaded into the AppDomain as is the case with Assembly.Load and Assembly.ReflectionOnlyLoad methods.
Properties
| Improve this Doc View SourceAssemblyName
Gets the name of the assembly.
Declaration
public AssemblyName AssemblyName { get; }
Property Value
Type | Description |
---|---|
AssemblyName | The name of the assembly or null if the file was not an assembly. |
AssemblyReferences
Gets references of the assembly.
Declaration
public IReadOnlyList<AssemblyName> AssemblyReferences { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<AssemblyName> | The assembly references. |
IsAssembly
Gets a value indicating whether the parsed file was indeed an assembly or not.
Declaration
public bool IsAssembly { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the file was a valid assembly or false otherwise. |
IsConsoleApplication
Gets a value indicating whether the PE file is a console application.
Declaration
public bool IsConsoleApplication { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the PE file is a console application, false if not. |
IsDll
Gets a value indicating whether the PE file is a DLL.
Declaration
public bool IsDll { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the PE file is a DLL, false if not. |
IsExe
Gets a value indicating whether the PE file is an executable.
Declaration
public bool IsExe { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the PE file is an executable, false if not. |
MetadataVersion
Gets the metadata version as specified in the assembly metadata.
Declaration
public string MetadataVersion { get; }
Property Value
Type | Description |
---|---|
String | The metadata version from the assembly metadata. |
TargetFramework
Gets target framework as provided by the TargetFrameworkAttribute.
Declaration
public FrameworkName TargetFramework { get; }
Property Value
Type | Description |
---|---|
FrameworkName | The target framework for which the assembly was built, or null if the information was not available. |
Remarks
This is only available if the assembly was build against .NET 4.0 or later. In previous versions of the .NET framework, this attribute was not available, and the correct target framework cannot be determined by inspecting the assembly metadata.
Methods
| Improve this Doc View SourceGetAssemblyInfo(Byte[])
Gets assembly information from the specified assembly.
Declaration
public static AssemblyInfo GetAssemblyInfo(byte[] rawAssembly)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | rawAssembly | A byte array that is a COFF-based image containing an emitted assembly. |
Returns
Type | Description |
---|---|
AssemblyInfo | The assembly information read. |
Remarks
This method does not throw an exception if the file is not an assembly. Instead the properties of the returned object must be inspected to determine whether it was a valid PE file and/or assembly.
GetAssemblyInfo(String)
Gets assembly information from the specified file.
Declaration
public static AssemblyInfo GetAssemblyInfo(string fileName)
Parameters
Type | Name | Description |
---|---|---|
String | fileName | The full path to the assembly file to retrieve metadata information from. |
Returns
Type | Description |
---|---|
AssemblyInfo | The assembly information read. |
Remarks
This method does not throw an exception if the file is not an assembly. Instead the properties of the returned object must be inspected to determine whether it was a valid PE file and/or assembly.