我怎么能确定所有的集会是我的.净桌面应用程序已经上膛?我想把它们放在关于框这样我就可以查询的客户通过电话来确定哪个版本的XYZ他们有他们的电脑。

它将很高兴看到这两个管理和不受管理的集会。我意识到的清单将得到长,但我的计划,以打增量上搜索它。

有帮助吗?

解决方案

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);
    }
  }
}

其他提示

要么,或系统。反射。大会。GetLoadedModules().

注意,程序域.GetAssemblies只会迭代议会 电流 程序域.这有可能应用到具有多个程序域,因此,可以或不可以做你想做的。

PowerShell版本:

[System.AppDomain]::CurrentDomain.GetAssemblies()

看起来像 AppDomain.CurrentDomain.GetAssemblies(); 将会做到:)

对于所有Dll包括非托管,你可以pinvoke EnumProcessModules获得的模块处理和随后使用GetModuleFileName每个处理得到的名字。

看看 http://pinvoke.net/default.aspx/psapi.EnumProcessModuleshttp://msdn.microsoft.com/en-us/library/ms683197(VS。85).aspx (pinvoke.net 没有签名,但是它很容易地图)。

64位需要使用EnumProcessModulesEx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top