首页 > 代码库 > c# 更改调用程序集(dll)位置

c# 更改调用程序集(dll)位置

 static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"lib\");
            path = Path.Combine(path, args.Name.Split(‘,‘)[0]);
            path = String.Format(@"{0}.dll", path);
            return System.Reflection.Assembly.LoadFrom(path);
        }

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

 

c# 更改调用程序集(dll)位置