473,395 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Finding Version of All Asemblies Required by Application

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
Nov 21 '05 #1
5 1417
"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/>

Nov 21 '05 #2
Top man Herfried. Thanks.

Charles
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@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/>

Nov 21 '05 #3
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@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
.. . . 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
Nov 21 '05 #4
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]" <hi***************@gmx.at> wrote in message
news:%2****************@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/>

Nov 21 '05 #5
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" <bl***@nowhere.com> wrote in message
news:Ou*************@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]" <hi***************@gmx.at> wrote in message
news:%2****************@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/>


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jeff elkins | last post by:
I'm creating an app that relies on a configuration file at launch. The file will always exist in the app's installation directory, but I have no control over where that might be. Is there an...
2
by: Terence Shek | last post by:
Is there a way to set the application binding policy so that it always binds to the latest version of an assembly? I'm hoping there is a way to avoid updating the application's binding...
6
by: Plumer | last post by:
Good morning everyone, I am having difficulty distributing a Release version of an application. System info C# DOTNET, MDE 2002, Version 7.0.9466 .Net Framework, version 1.0.3705 My...
6
by: Jay Bienvenu | last post by:
I have the following Visual Basic .NET code in an ASP.NET project: ' ... Dim xdStructure As XmlDocument Dim xnStructureRoot As XmlNode xdStructure = New XmlDocument...
4
by: Dica | last post by:
i need to create a config.xml file for my app. i'd like it to show up under the installation folder (user selected). is there a way to do this? tks
6
by: graham.macpherson | last post by:
I have 2 Suse Linux PCs which I compile my code on. Until recently they both had gcc 4.0.X on them, but I upgraded one of them to gcc 4.1.0. I have come across a very strange problem in the...
5
by: wenning | last post by:
Hello, I am struggling with a website on a W2K3 server which has the actual content on a NAS server (also W2K3 based). The servers doesn't run in a domain and arent intended to. I did make...
4
by: Academic | last post by:
I have statements that enable visual styles in Application.Designer and in Application.myApp I also have in Main Application.EnableVisualStyles() Is that still required in version 2.0 ?
7
by: Aleksander Oven | last post by:
Hi, I'm building a native application that will host managed 3rd-party assemblies. Before loading each assembly, I'd like to check if the required CLR and .NET version are present, and display a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.