询问者
【请教前辈,如何使用C#获取.NET托管程序的完整进程模块】

问题
全部回复
-
您好,可以使用AppDomain的AppDomain.GetAssemblies方法
https://docs.microsoft.com/en-us/dotnet/api/system.appdomain.getassemblies?view=netframework-4.7.2
ericzhou
-
using System; using System.Reflection; using System.Security.Policy; class ADGetAssemblies { public static void Main() { AppDomain currentDomain = AppDomain.CurrentDomain; //Provide the current application domain evidence for the assembly. Evidence asEvidence = currentDomain.Evidence; //Load the assembly from the application directory using a simple name. //Create an assembly called CustomLibrary to run this sample. currentDomain.Load("CustomLibrary",asEvidence); //Make an array for the list of assemblies. Assembly[] assems = currentDomain.GetAssemblies(); //List the assemblies in the current application domain. Console.WriteLine("List of assemblies loaded in current appdomain:"); foreach (Assembly assem in assems) Console.WriteLine(assem.ToString()); } }
ericzhou
-
你好,
在下面的代码中改成你自己要load的DLL.
//Create an assembly called CustomLibrary to run this sample. currentDomain.Load("yourdll",asEvidence);
Best regards,
Zhanglong
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- 已建议为答案 Zhanglong WuMicrosoft contingent staff, Moderator 2018年12月3日 1:42