How to use CustomAction in WIX Bundle?

2019-02-12 17:24发布

To give you a background - I have a 4 MSI's which comes from our vendor and this has to go to our company servers (we are looking at around 3500 servers). As of now, my counterparts are managing this using vbs, ps1 scripts. But the problem with the script is that everytime an update comes we have to worry about uninstalling the existing package before running the new one and a ton of hardcoding.

I want to automate the whole process (with very less hardcoding) by setting up a WIX script to package all the 4 MSI's together. I read about the WIX bundle and used that to create a single MSI. But now there are lot of a variables to be passed to the 4 MSI's, so I thought of using custom actions to set these variables based on the environment/machine where the MSI is running. But I cant make custom action to work? Am i missing something?

A little bit of googling and I saw something like there are no CustomActions in Bundle? can someone confirm?

Also if there are no CA's what are my options? how can I manipulate the variables to be passed on to the 4 MSI's? Most of them needs to be set based on the machine its being run (like install path, user id's, app pool id's etc).

标签: wix wix3.6 burn
2条回答
甜甜的少女心
2楼-- · 2019-02-12 17:52

There is a fourth option, a useful lightweight hack, identified by Vijay Kotecha (see http://vijayskotecha.blogspot.com/2013/07/wix-bootstrapper-custom-action.html),...

Essentially, build an <ExePackage> around a pass-through .bat or .cmd batch file. The batch/command file contains the single line '%*' which re-executes all of the command line arguments as a first class command.

Thus:

<ExePackage ... SourceFile="SourcePath\WixCustomAction.cmd"
    InstallCommand="my_custom_action.exe my_custom_parameters" />
<ExePackage ... SourceFile="SourcePath\WixCustomAction.cmd"
    InstallCommand="my_next_action.exe my_next_parameters" />

Where WixCustomAction.cmd is a file containing only '%*'.

These <ExePackages> can be placed into the <Bundle><Chain> successively as needed using different InstallCommands as needed.

查看更多
三岁会撩人
3楼-- · 2019-02-12 17:56

As I see it, you have three options:

  1. Depending on what information you need, you can use the WixUtilExtension to perform simple tasks such as reading registry keys and performing file searches, which you can then pass the results to your installation packages as properties.

  2. Implement custom actions in the individual installation packages themselves (not in the bundle).

  3. Write your own custom bootstrapper application to determine all the properties you need to set, and then pass them to your installation packages. This is more complex than the #1 and #2, but if your interested the following links should get you started: introducing managed bootstrapper applications and write a wpf wix installer

查看更多
登录 后发表回答