Search code examples
c++visual-studiowindows-installer

Launching an exe at the end of a Visual Studio Setup Project of a c++ Project


The only useful resource that describes how to launch an exe after the Visual Sutio Setup Project is finished is: https://www.codeproject.com/Articles/19560/Launching-Your-Application-After-Install-using-Vis.

However, my project is written in c++ and I don't see how I can integrate the InstallerClass.cs which is a c# class.

The reason I know it is not being automatically integrated into the install is because I get the error: "There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected."


Solution

  • I suggest that you could use InstallShield to realize the automatic operation of the program after installation.

    The method of implementation is: In the OnEnd() function of the InstallScript script, call the executable program.

    Note: The INSTALLDIR predefined variable stores the installation directory of the program.

    You could refer to the following example.

    //Run dispatcher after installation
    strPath=INSTALLDIR+"dispatcher";
    strName="Frs.exe";
    FindFile(strPath,strName,strResult);
    if(strResult!="") then
        strPath=strPath+"\\"+strName;
        LaunchAppAndWait(strPath,"",NOWAIT);
    endif;