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;

 

posted @ 2017-06-02 08:57  大侠呀  阅读(1710)  评论(0)    收藏  举报