in

dotNetFreak

Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

Displaying a List of Referenced Assemblies

Yet another post on ideas for 'About' windows...

Having a list of assemblies displayed that your application references can be helpful in determining problems with your application due to version inconsistencies etc. By adding a listview to your window and making use of code similar to the below you can easily display the name and version of all assemblies referenced by your application.

Imports System.Reflection

Private Sub PopulateListView()

'Get a list of referenced assemblies

Dim assemblyNames() As System.Reflection.AssemblyName = [Assembly].GetExecutingAssembly.GetReferencedAssemblies

Dim assemblyName As System.Reflection.AssemblyName

Dim listViewItem As System.Windows.Forms.ListViewItem

Dim i As Integer

'Add each assemblies information to the listview

For i = assemblyNames.GetLowerBound(0) To assemblyNames.GetUpperBound(0)

assemblyName = CType(assemblyNames.GetValue(i), System.Reflection.AssemblyName)

listViewItem = New System.Windows.Forms.ListViewItem

listViewItem.Text = assemblyName.Name

listViewItem.SubItems(1).Text = assemblyName.Version.ToString

listView.Items.Add(listViewItem)

Next i

End Sub

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  

Protected by FormShield
Refresh
Listen
Please enter the characters shown on the image


Code:


Add
Shopbot
Shopbot

 

 

Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems