Reputation: 9921
In .NET c# 3.5 I have a console application (A) that references several assemblies(X, Y, Z).
How can I get the version information of the loaded assemblies at run time?
I can use reflection to get the info on the currently executing assembly like this
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
but not the loaded assemblies. Thanks for your help!
Upvotes: 1
Views: 5146
Reputation: 1503459
JP's answer will give you all of the assemblies in the AppDomain. If you only want the assemblies that your current assembly references directly, you can use:
var names = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
That will give you the names, including version information.
Upvotes: 4
Reputation: 45127
You can get the list of loaded assemblies from the AppDomain ...
var la = AppDomain.CurrentDomain.GetAssemblies();
Upvotes: 8