Home All Groups Group Topic Archive Search About

Finding Version of All Asemblies Required by Application

Author
22 Mar 2005 11:23 AM
Charles Law
I want to display the name and version of all assemblies (dlls?)
used/required by my application in a Help | About box. Is there a way to do
this?

One of the problems I anticipate is that assemblies are only loaded when
required. When my app loads not all assemblies are loaded. If the user goes
straight to the Help About box then there will still be assemblies required
but not yet loaded, so I would need a way of getting these as well. This
also presents a problem if an assembly is required by some sub-function of
my application, and it is not apparent that it is missing when the program
is first run.

TIA

Charles

Author
22 Mar 2005 12:30 PM
Herfried K. Wagner [MVP]
"Charles Law" <bl***@nowhere.com> schrieb:
>I want to display the name and version of all assemblies (dlls?)
>used/required by my application in a Help | About box. Is there a way to do
>this?
>
> One of the problems I anticipate is that assemblies are only loaded when
> required. When my app loads not all assemblies are loaded. If the user
> goes straight to the Help About box then there will still be assemblies
> required but not yet loaded, so I would need a way of getting these as
> well. This also presents a problem if an assembly is required by some
> sub-function of my application, and it is not apparent that it is missing
> when the program is first run.

Solution for referenced assemblies:

\\\
With Me.ListView1
    .View = View.Details
    Dim c1 As New ColumnHeader
    c1.Text = "Library"
    c1.Width = 140
    Dim c2 As New ColumnHeader
    c2.Text = "Version"
    c2.Width = 80
    .Columns.AddRange(New ColumnHeader() {c1, c2})
    For Each m As AssemblyName In _
        [Assembly].GetExecutingAssembly().GetReferencedAssemblies()

        Dim lvi As New ListViewItem
        lvi.Text = m.Name
        lvi.SubItems.Add(m.Version.ToString())
        .Items.Add(lvi)
    Next m
End With
///

For the other DLLs, you could use the 'FileVersionInfo' class to get the
files' version numbers.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
23 Mar 2005 3:25 PM
Charles Law
Hi Herfried

I have been playing with the code below, and I've found that it does not
list all the assemblies that I expect. In particular, what I am looking for
is an assembly that is referenced by one of the assemblies in the list, but
which is not directly referenced by the executing assembly, if that makes
sense. It is not obvious to me how I can get that.

Also, I would like to be able to get more information about each assembly,
such as its location.

Charles


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%23W4I9qtLFHA.3788@tk2msftngp13.phx.gbl...
> "Charles Law" <bl***@nowhere.com> schrieb:
>>I want to display the name and version of all assemblies (dlls?)
>>used/required by my application in a Help | About box. Is there a way to
>>do this?
>>
>> One of the problems I anticipate is that assemblies are only loaded when
>> required. When my app loads not all assemblies are loaded. If the user
>> goes straight to the Help About box then there will still be assemblies
>> required but not yet loaded, so I would need a way of getting these as
>> well. This also presents a problem if an assembly is required by some
>> sub-function of my application, and it is not apparent that it is missing
>> when the program is first run.
>
> Solution for referenced assemblies:
>
> \\\
> With Me.ListView1
>    .View = View.Details
>    Dim c1 As New ColumnHeader
>    c1.Text = "Library"
>    c1.Width = 140
>    Dim c2 As New ColumnHeader
>    c2.Text = "Version"
>    c2.Width = 80
>    .Columns.AddRange(New ColumnHeader() {c1, c2})
>    For Each m As AssemblyName In _
>        [Assembly].GetExecutingAssembly().GetReferencedAssemblies()
>
>        Dim lvi As New ListViewItem
>        lvi.Text = m.Name
>        lvi.SubItems.Add(m.Version.ToString())
>        .Items.Add(lvi)
>    Next m
> End With
> ///
>
> For the other DLLs, you could use the 'FileVersionInfo' class to get the
> files' version numbers.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
13 Apr 2005 7:58 AM
Charles Law
Does any one have any further information on this subject?

I am trying to list all required assemblies for my application, and identify
where they are loaded from. The code below lists those assemblies that are
loaded, but if one of those requires a further assembly it is not listed.

Can anyone suggest a way of doing this?

Thanks.

Charles


Show quoteHide quote
"Charles Law" <bl***@nowhere.com> wrote in message
news:Oupc9x7LFHA.904@tk2msftngp13.phx.gbl...
> Hi Herfried
>
> I have been playing with the code below, and I've found that it does not
> list all the assemblies that I expect. In particular, what I am looking
> for is an assembly that is referenced by one of the assemblies in the
> list, but which is not directly referenced by the executing assembly, if
> that makes sense. It is not obvious to me how I can get that.
>
> Also, I would like to be able to get more information about each assembly,
> such as its location.
>
> Charles
>
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:%23W4I9qtLFHA.3788@tk2msftngp13.phx.gbl...
>> "Charles Law" <bl***@nowhere.com> schrieb:
>>>I want to display the name and version of all assemblies (dlls?)
>>>used/required by my application in a Help | About box. Is there a way to
>>>do this?
>>>
>>> One of the problems I anticipate is that assemblies are only loaded when
>>> required. When my app loads not all assemblies are loaded. If the user
>>> goes straight to the Help About box then there will still be assemblies
>>> required but not yet loaded, so I would need a way of getting these as
>>> well. This also presents a problem if an assembly is required by some
>>> sub-function of my application, and it is not apparent that it is
>>> missing when the program is first run.
>>
>> Solution for referenced assemblies:
>>
>> \\\
>> With Me.ListView1
>>    .View = View.Details
>>    Dim c1 As New ColumnHeader
>>    c1.Text = "Library"
>>    c1.Width = 140
>>    Dim c2 As New ColumnHeader
>>    c2.Text = "Version"
>>    c2.Width = 80
>>    .Columns.AddRange(New ColumnHeader() {c1, c2})
>>    For Each m As AssemblyName In _
>>        [Assembly].GetExecutingAssembly().GetReferencedAssemblies()
>>
>>        Dim lvi As New ListViewItem
>>        lvi.Text = m.Name
>>        lvi.SubItems.Add(m.Version.ToString())
>>        .Items.Add(lvi)
>>    Next m
>> End With
>> ///
>>
>> For the other DLLs, you could use the 'FileVersionInfo' class to get the
>> files' version numbers.
>>
>> --
>> M S   Herfried K. Wagner
>> M V P  <URL:http://dotnet.mvps.org/>
>> V B   <URL:http://classicvb.org/petition/>
>
>