How to get DLL details?

G

Guest

Hi
I have to follow closely DLL-versions in different client enviroments.
My goal is to build a web page which shows information of all dll:s in one
page.

So it should:
1. Read through all DLL:s in "bin" directory
2. Print Name, Version number and AssemblyDescription of each dll

Pseudo code would be something like:
foreach(dllFIle in binDirectory)
{
string ver = dllFile.Version
string desc = dllFile.Description
}

So how to get started?
System.IO.File provides access only to file attributes.

Which class provides methods to extract assembly information out of dll?
 
M

Mythran

Jouni Karppinen said:
Hi
I have to follow closely DLL-versions in different client enviroments.
My goal is to build a web page which shows information of all dll:s in one
page.

So it should:
1. Read through all DLL:s in "bin" directory
2. Print Name, Version number and AssemblyDescription of each dll

Pseudo code would be something like:
foreach(dllFIle in binDirectory)
{
string ver = dllFile.Version
string desc = dllFile.Description
}

So how to get started?
System.IO.File provides access only to file attributes.

Which class provides methods to extract assembly information out of dll?

Dim asm As [Assembly] =
[Assembly].GetAssembly(GetType(InternalMain))

Console.WriteLine("Version: " & asm.GetName().Version.ToString(4))

Dim attributes As Object() = asm.GetCustomAttributes(True)

For Each attribute As Object In attributes
If TypeOf(attribute) Is AssemblyDescriptionAttribute
Console.WriteLine( _
"Description: " & _
DirectCast( _
attribute, _
AssemblyDescriptionAttribute _
).Description _
)
Else
Console.WriteLine("Attribute: " &
attribute.GetType().ToString())
End If
Next


Above is just a sample...cut & paste using a Console application...

Instead of using Assembly.GetAssembly (from System.Reflection), you can use
Assembly.LoadFile.

HTH,

Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top