How to get information about a loaded assembly at runtime? (C #, .NET)

In .NET C # 3.5, I have a console application (A) that references multiple assemblies (X, Y, Z).

How can I get version information of loaded assemblies at runtime?

I can use reflection to get information about the current executable assembly, for example

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() 

but not loaded assemblies. Thank you for your help!

+1
c # assemblies
source share
2 answers

JP's answer will give you all the builds in AppDomain. If you want assemblies to refer directly to your current assembly, you can use:

 var names = Assembly.GetExecutingAssembly().GetReferencedAssemblies(); 

This will give you names, including version information.

+1
source share

You can get the list of downloaded assemblies from AppDomain ...

 var la = AppDomain.CurrentDomain.GetAssemblies(); 
+7
source share

All Articles