Get Assembly Info (Assembly Path)
Loads an assembly from the specified file path and retrieves its metadata information.
The function return a tuple containing:
- Product: The product name defined in the assembly.
- Version: The file version of the assembly.
- Copyright: The copyright text.
- Company: The name of the company that produced the assembly.
- Platform: The target platform (e.g., (AnyCPU), (x64), (x86)).
- Framework: The .NET framework version targeted by the assembly.
- Description: The description text of the assembly.
If the file does not exist or an error occurs, all values are returned as empty strings.
VB
Public Function GetAssemblyInfo(assemblyPath As String) As
(Product As String,
Version As String,
Copyright As String,
Company As String,
Platform As String,
Framework As String,
Description As String)
Dim szDummy As String = String.Empty
' Check if the file exists
If Not IO.File.Exists(assemblyPath) Then
Return (szDummy, szDummy, szDummy, szDummy, szDummy, szDummy, szDummy)
End If
Try
Dim Assembly As Assembly = Assembly.LoadFrom(assemblyPath)
Return GetAssemblyInfo(Assembly)
Catch ex As Exception : End Try
Return (szDummy, szDummy, szDummy, szDummy, szDummy, szDummy, szDummy)
End Function