"Jouni Karppinen" <Jo************@discussions.microsoft.com> wrote in
message news:65**********************************@microsof t.com...
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