|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Finding Version of All Asemblies Required by ApplicationI 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" <bl***@nowhere.com> schrieb: Solution for referenced assemblies:>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. \\\ 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/> 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/> 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/> > >
Loop ?
How to update an application Binding an Array to a Combo Box SqlDataReader accessed only by field ordinals? Singleton Pattern for Database Access --- Leave Open or Close Connection "Add Reference" hosed--doesn't display the dialog in VS.NET PDF to Picturebox repainting problem datagrid woes VB.net Datagrid Parent Row |
|||||||||||||||||||||||