Dot-Net
確定載入的程序集
如何確定我的 .NET 桌面應用程序已載入的所有程序集?我想把它們放在關於框中,這樣我就可以通過電話查詢客戶以確定他們在他們的 PC 上使用的 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); } } }
PowerShell 版本:
[System.AppDomain]::CurrentDomain.GetAssemblies()