Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Location and File Version of GetReferencedAssemblies()?

5 views
Skip to first unread message

Joe Duchtel

unread,
Dec 18, 2009, 7:57:21 AM12/18/09
to
Hello -

I would like to extract the location and file version (not assembly
version) of all referenced assemblies in an assembly.

The following will output the names and assembly versions (plus other
information) ...

Dim lAssemblyNames() As AssemblyName =
[Assembly].GetExecutingAssembly.GetReferencedAssemblies

For Each lAssemblyName As AssemblyName In lAssemblyNames
Console.WriteLine(lAssemblyName.ToString)
Next

... but I would like to get the file version and location just like
for the executing assembly ...

Dim lAssembly As Assembly = [Assembly].GetExecutingAssembly
Dim lFileVersion As String = FileVersionInfo.GetVersionInfo
(lAssembly.Location).FileVersion.ToString

Is there any way to get this information from the AssemblyName?

Thanks,
Joe

Joe Duchtel

unread,
Dec 21, 2009, 6:50:21 AM12/21/09
to

Hello -

Okay ... I just figured out how to do this ... here we go ...

Dim lAssemblyNames() As AssemblyName =
[Assembly].GetExecutingAssembly.GetReferencedAssemblies

For Each lAssemblyName As AssemblyName In lAssemblyNames

Dim lLocation As String = [Assembly].ReflectionOnlyLoad
(lAssemblyName.ToString).Location


Dim lFileVersion As String = FileVersionInfo.GetVersionInfo

(lLocation).FileVersion.ToString

Console.WriteLine(lFileVersion)
Next

Joe

0 new messages