Finding Version of All Asemblies Required by Application

  • Thread starter Thread starter Charles Law
  • Start date Start date
C

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
 
Charles Law said:
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.
 
Top man Herfried. Thanks.

Charles


Herfried K. Wagner said:
Charles Law said:
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.
 
Herfried K. Wagner said:
Charles Law said:
I want to display the name and version of all assemblies (dlls?)
used/required by my application
.. . .
Solution for referenced assemblies:
[Assembly].GetExecutingAssembly().GetReferencedAssemblies()

Herfried,

That works a treat /if/ the assembly can actually be run, but one
problem I've encountered is when a /missing/, referenced assembly
prevents an application from even starting; depending on the type of
application, it can be /very/ difficult to determine which is the missing
one. (Needless to say, we don't use installers for our in-house written
applications).

Is there an equivalent for an Assembly sitting (inoperable) on disk?

TIA,
Phill W.

have
 
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 said:
Charles Law said:
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.
 
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


Charles Law said:
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 said:
Charles Law said:
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.
 

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

Back
Top