zoukankan      html  css  js  c++  java
  • VS打包同时运行其他程序或命令的相关资料收集

    VS自带的打包程序同时自动运行一个EXE或批处理命令

    我做的继承类的代码是这样的,请指点 
    using System; 
    using System.Collections.Generic; 
    using System.ComponentModel; 
    using System.Configuration.Install; 
    using System.Diagnostics; 
    using System.IO; 


    namespace ClassLibrary1 

      [RunInstaller(true)] 
      public partial class Installer1 : Installer 
      { 
      public Installer1() 
      { 
      InitializeComponent(); 
      } 
      public override void Install(System.Collections.IDictionary stateSaver) 
      { 

      base.Install(stateSaver); //调整后,这句放在了上面

      Process p = new Process(); 
      p.StartInfo.RedirectStandardOutput = false; 
      // p.StartInfo.FileName = @"mybat.exe"; 
      p.StartInfo.FileName = @"C:\Program Files\营收系统\update.bat"; //这样只后到是能找到批处理文件了
      p.StartInfo.UseShellExecute = true; 
      p.Start(); 
      p.WaitForExit(); 
      p.Dispose(); 
      } 
      } 
    }

    转载自:http://topic.csdn.net/u/20080925/15/7416f613-0ced-460d-90f8-fbe6623add08.html

    用VS2005打包,如何让主程序在安装完成后自动启动?
    在网上找到写这段代码,

      protected override void OnAfterInstall(System.Collections.IDictionary savedState) 
      { 
      base.OnAfterInstall(savedState); 
      path = this.Context.Parameters[ "targetdir "] + "你的程序.exe "; 
      System.Diagnostics.Process.Start(path);  
      } 

    添加一个新项目,项目类型为类库,然后在这个项目中添加一个安装程序类.
    添加类似下面的代码:
    C# code
    using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; namespace CustomSetup { [RunInstaller(true)] public partial class Installer1 : Installer { public Installer1() { InitializeComponent(); } public override void Commit(System.Collections.IDictionary savedState) { base.Commit(savedState); //添加自定义操作代码 } } }

    摘自:http://topic.csdn.net/u/20080416/09/e6d8e720-2bb5-4248-a3bd-bcfb30c10efa.html

     添加自定义操作后,安装时未能找到.installstate文件的问题

    在添加自定义操作时,一定要在Install中也添加上输出。可能是因为在Install阶段进行.installstate文件的创建。所以如果不在Install中添加输出的话,就会提示找不到相应的.installstate文件。
    比如在自定义操作中重写了Commit方法,只想在安装结束后进行自定义操作,但是在制作安装文件添加自定义操作时,应该同时在Install和Commit中添加输出。
    具体操作参照
    http://msdn2.microsoft.com/zh-cn/library/d9k65z2d(VS.80).aspx

    转载:http://blog.csdn.net/songkexin/archive/2008/01/19/2052393.aspx

  • 相关阅读:
    假期小作业1
    Python_day4
    Python_day3
    Python_day2
    12/06
    12/05
    python系统学习:第三周之简单的三级菜单
    python系统学习:第二周之字典应用
    python系统学习:第二周之字符串函数练习
    python系统学习:第二周之购物车功能
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1770654.html
Copyright © 2011-2022 走看看