我想在作安装包里自定义执行某个应用程序,结果添加完后不行。
做好自定义操作的工程。
Process p = new Process();
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = @"D:\aaa.exe";
            psi.Arguments = "";
            p.StartInfo = psi;
            p.Start();
放到应用程里能够执行。
在安装项目里
我添加自定义操作后,选择此工程项目,类型为输出。
编译后执行安装挺顺利,自定操作没有执行。
高手救命,已经好几天没解决了,help mehelp mehelp mehelp me;

解决方案 »

  1.   

    [RunInstaller(true)]
    public class ClientCustomAction : System.Configuration.Install.Installer
    {
    [System.Diagnostics.DebuggerStepThrough()]
    private void InitializeComponent()
    {
    } public override void Install(System.Collections.IDictionary stateSaver)
    {
    base.Install(stateSaver);
    try
    {
    //执行你的操作
    }
    catch(Exception ex)
    {
    throw ex;
    }
    }}
    我的程序这么写,没有问题
      

  2.   

    你保证安装后有D:\aaa.exe有这个东西吗?可能需要在OnAfterInstall中做以上处理
      

  3.   

    楼上的大哥,在Install()里做安装sql express 2005 不行
               {Process p = new Process();
                ProcessStartInfo psi = new ProcessStartInfo();
                psi.FileName = @"D:\aaa.exe";
                psi.Arguments = "";
                p.StartInfo = psi;
                p.Start();
                Process p = new Process();
                ProcessStartInfo psi = new ProcessStartInfo();
                psi.FileName = @"D:\aaa.exe";
                psi.Arguments = "";
                p.StartInfo = psi;
                p.Start();
                },
    其他的操作都行。
      

  4.   

    TO: thinkc(【抗火、抗冰冻、抗闪电、抗毒、物理攻击无效】) [System.Diagnostics.DebuggerStepThrough()]是什么意思?向你学习一下,我没有用过这个属性.
      

  5.   

    楼主如果是要安装SqlExpress2005,安装程序自己就可以安装,不用在自己定义了.
    方法是把SqlExpress2005作为程序的必备组件,在安装的程序的时候用SetUp,系统提示安装SqlExpress2005,不用自已来写怎么安装.
    可以在安装项目的属性中找到"系统必备",然后添加就行了.