zoukankan      html  css  js  c++  java
  • C#通过代码判断并注册程序集到GAC

                var dllName = "EasyHook.dll";
                var dllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dllName);
                if (System.Runtime.InteropServices.RuntimeEnvironment.FromGlobalAccessCache(Assembly.LoadFrom(dllPath)))
                    new System.EnterpriseServices.Internal.Publish().GacRemove(dllPath);
                Thread.Sleep(100);
                new System.EnterpriseServices.Internal.Publish().GacInstall(dllPath);
                Thread.Sleep(100);
                if (System.Runtime.InteropServices.RuntimeEnvironment.FromGlobalAccessCache(Assembly.LoadFrom(dllPath)))
                    Console.WriteLine("{0} registered to GAC successfully.", dllName);
                else
                    Console.WriteLine("{0} registered to GAC failed.", dllName);
    
                dllName = "ComplexParameterInject.dll";
                dllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dllName);
                if (System.Runtime.InteropServices.RuntimeEnvironment.FromGlobalAccessCache(Assembly.LoadFrom(dllPath)))
                    new System.EnterpriseServices.Internal.Publish().GacRemove(dllPath);
                Thread.Sleep(100);
                new System.EnterpriseServices.Internal.Publish().GacInstall(dllPath);
                Thread.Sleep(100);
                if (System.Runtime.InteropServices.RuntimeEnvironment.FromGlobalAccessCache(Assembly.LoadFrom(dllPath)))
                    Console.WriteLine("{0} registered to GAC successfully.", dllName);
                else
                    Console.WriteLine("{0} registered to GAC failed.", dllName);
  • 相关阅读:
    %u编码
    总结
    windows7 安装PHP7 本地网站搭建
    统计某个端口的链接数
    mysql连结查询
    mysql in
    读书笔记<白帽子讲web安全>
    Web攻防系列教程之文件上传攻防解析(转载)
    攻防:文件上传漏洞的攻击与防御
    weblogic检查项
  • 原文地址:https://www.cnblogs.com/nanfei/p/7458253.html
Copyright © 2011-2022 走看看