Hi,

Does anyone know what the simplest way to retrieve the version number
of a referenced DLL is?

Thanks for all the help....

Dinu

Re: Get Assembly version by Herfried

Herfried
Mon Jul 17 05:37:35 CDT 2006

<dinuks@gmail.com> schrieb:
> Does anyone know what the simplest way to retrieve the version number
> of a referenced DLL is?

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/>

Re: Get Assembly version by jimbo_dk

jimbo_dk
Mon Jul 17 20:06:44 CDT 2006

Works like a charm. FileversionInfo was what I was looking for.

Thanks a lot for the help.

Dinu

Herfried K. Wagner [MVP] wrote:
> <dinuks@gmail.com> schrieb:
> > Does anyone know what the simplest way to retrieve the version number
> > of a referenced DLL is?
>
> 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/>