在.NET c#3.5中,我有一个控制台应用程序(A),它引用了几个程序集(X,Y,Z).
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!
推荐答案JP的答案将为您提供AppDomain中的所有程序集.如果只希望当前程序集直接引用的程序集,则可以使用:
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.
更多推荐
如何在运行时检索有关已加载程序集的信息? (C#、. NET)
发布评论