Пример #1
0
 /// <summary>
 /// 安装自身
 /// </summary>
 public static void InStallSelf()
 {
     System.Collections.Hashtable installcode = new System.Collections.Hashtable();
     using (TransactedInstaller ti = new TransactedInstaller())
     {
         try
         {
             AssemblyInstaller ass = new AssemblyInstaller(Assembly.GetExecutingAssembly().Location, new String[0]);
             ti.Installers.Add(ass);
             ti.Install(installcode);
         }
         catch
         {
             ti.Rollback(installcode);
         }
     }
 }