简体   繁体   中英

Change upgrade location with silent installation of WiX Installer

I have built an installer using WiX which lets the user upgrade a current installation to the next version and change the location of the install folder. This works when using the .msi file, but when running this silently using msiexec, my setting of the INSTALLDIR is overwritten later on in the installation process.

I have had a look at the logs and it is being written over with the current install directory. I have a property which searches the registry for the current install location and sets the INSTALLDIR to that value.

I guess in the .msi UI value, things are running in the right order, but with the silent install, they're not.

MSI (s) (A0:90) [09:47:34:315]: PROPERTY CHANGE: Modifying INSTALLDIR property. Its current value is 'C:\SpecifiedInSilentInstall'. Its new value: 'C:\CurrentInstallDirectoryFromRegistry\'.

Is there a way of specifying the order in a CustomAction or something?

If you are using a custom action like this

<CustomAction Id="SetInstallDir" Property="INSTALLDIR" Value="[YourInstallDir]" />

you can time it in your <InstallExecuteSequence> section like this

<Custom Action="SetInstallDir" Before="CostFinalize" />

Here you can time your events with Before and After . These events follow a specific order (taken from FIREGIANT )

  • AppSearch
  • LaunchConditions
  • ValidateProductID
  • CostInitialize
  • FileCost
  • CostFinalize
  • InstallValidate
  • InstallInitialize
  • ProcessComponents
  • UnpublishFeatures
  • RemoveShortcuts
  • RemoveFiles
  • InstallFiles
  • CreateShortcuts
  • RegisterUser
  • RegisterProduct
  • PublishFeatures
  • PublishProduct
  • InstallFinalize
  • RemoveExistingProducts

For the property INSTALLDIR it is important to set it at the right event to take effect (whatever your needs are). For me Before=CostFinalize changes the path to the one I want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM