Peacelyk
Peacelyk

Reputation: 1146

Uninstallation problem

When program is installed it is fired(by the installer) right after installation finishes. But when i uninstall the program from Control Panel, then it tries to open the exe too, which gives the following error:

Windows cannot find 'MyExe.com'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.

with the cmd.exe in the background. after i press OK, another window pops up, saying:

There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support...

Although the program gets uninstalled, these errors are not desirable.

Also when i install newer version and older version of the program already exists, i get similar messages as the installer tries to uninstall older version first.

Here is the code:

....

<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />

    <Upgrade Id="D2B0D435-0F86-4D5E-A988-B24215882***">  
      <UpgradeVersion
        Minimum="1.0.0.0" Maximum="99.0.0.0"
        Property="PREVIOUSVERSIONSINSTALLED"
        IncludeMinimum="yes" IncludeMaximum="no" />
      </Upgrade> 

    <CustomAction Id="LaunchApp" Directory="INSTALLDIR" ExeCommand="[SystemFolder]cmd.exe /C start MyExe.exe" />

    <InstallExecuteSequence>
      <RemoveExistingProducts Before="InstallInitialize" /> 
      <Custom Action="LaunchApp" After="InstallFinalize" />
    </InstallExecuteSequence>
  </Product>
</Wix>

What i would like, is that installer would try to run the program only when installation occurs and do nothing when uninstallation is processed.

Thanks in advance!

Upvotes: 2

Views: 398

Answers (1)

Christopher Painter
Christopher Painter

Reputation: 55571

Your problem is that you don't have a condition on the action so it fires every time. At a minimum you need a condition of "Not Installed". However for a more elegant solution, read:

How To: Run the Installed Application After Setup

Upvotes: 4

Related Questions