Jobacca
Jobacca

Reputation: 191

Wix - Run batch-scripts before the Installation (for deleting previous installation)?

what i have:

  1. the purpose to roll-out an service via msi-package (listed in services.msc)
  2. the service is using custom dlls
  3. an InstallExecuteSequence with custom actions with
    • <... After="InstallFinalize">NOT Installed</Custom> for installation
    • <... Before="InstallInitialize">Installed</Custom> for uninstallation
  4. until now the service is installed manually on the workstations without an msi-package and without been registered as applications (so it's not shown in appwiz.cpl)

what's the problem:

so what i want:

what's the solution:

yeah, hope for it standing below my text soon:) maybe the title is not very good, thats because I don't have an idea how to go further...

Upvotes: 1

Views: 685

Answers (2)

Jobacca
Jobacca

Reputation: 191

ServiceControl elements: Cool thing, but I had a similar problem: if the previous (manually) installed services is still running while running the msi-package a popup asks what to do (stop service, cancel, ..).

I ended up with separating the concern of uninstalling the previous version from the new installation-routine. i simple wrote a batch-skript which runs before the msi-package will run.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55581

The easiest way to back you out of the corner you find yourself in is to write an installer that uses the ServiceInstall and ServiceControl elements (Remove attribute with Both value) to define the service. Target the files to a new directory that wasn't used before so that your reference counts aren't all messed up. Use the RemoveFile element to delete the old installation of the files for good measure. The goal is to be able to upgrade removing the fold files and uninstall with everything gone.

If the old files weren't consistently deployed to the same directory you'll either have to come up with a list of known directories and write duplicate RemoveFile statements or write a custom action that searches for the files and deletes them. (Suboptimal)

Upvotes: 1

Related Questions