确定加载组件 [英] Determine Loaded Assemblies
本文介绍了确定加载组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何确定我的.NET桌面应用程序加载的所有程序集?我想把它们放在盒子里,所以我可以通过电话查询客户,以确定他们在他们的电脑上有什么版本的XYZ。
How can I determine all of the assemblies that my .NET desktop application has loaded? I'd like to put them in the about box so I can query customers over the phone to determine what version of XYZ they have on their PC.
这将是很好查看被管理的和非托管的程序集。我意识到这个列表会很长,但是我打算在其上追加一个增量搜索。
It would be nice to see both managed and unmanaged assemblies. I realize the list will get long but I plan to slap an incremental search on it.
推荐答案
using System;
using System.Reflection;
using System.Windows.Forms;
public class MyAppDomain
{
public static void Main(string[] args)
{
AppDomain ad = AppDomain.CurrentDomain;
Assembly[] loadedAssemblies = ad.GetAssemblies();
Console.WriteLine("Here are the assemblies loaded in this appdomain\n");
foreach(Assembly a in loadedAssemblies)
{
Console.WriteLine(a.FullName);
}
}
}
这篇关于确定加载组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文