Location and File Version of GetReferencedAssemblies()?

  • Thread starter Thread starter Joe Duchtel
  • Start date Start date
J

Joe Duchtel

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

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
 
Back
Top