AppDomain.CurrentDomain.GetAssemblies() 这个函数获取当前应用域中已加载的程序集,注意,在Asp.Net Core环境下,bin目录下的程序集不一定都被加载,这与.Net Framework下的情况不同。如果需要加载响应的程序集,需要使用Load方法进行加载,示例如下:
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);
网友评论