问题
I already posted a related problem here: Wix: Managed BA command line not effective, which is about command line passed during upgrade.
Now I tried to explore, how it interpret the command line. Here is my run method to do so:
protected override void Run()
{
string cmdOptions = string.Empty;
this.Engine.Log(LogLevel.Verbose, "Launching custom TestBA UX");
Debug.WriteLine("Command.Display: {0} Command.Action: {1}", this.Command.Display.ToString(), this.Command.Action.ToString());
Environment.Exit(1);
}
I understand that Wixdba would digest its own command line options and would pass extra to our Managed Bootstrapper Application. From above mentioned post, this line from log:
[1A44:1E54][2014-02-24T17:47:22]i301: Applying execute package: {f1d57671-5e3d-4be7-908f-5a47e72737d9}, action: Uninstall, path: C:\ProgramData\Package Cache\{f1d57671-5e3d-4be7-908f-5a47e72737d9}\BootstrapperSetup.exe, arguments: '"C:\ProgramData\Package Cache\{f1d57671-5e3d-4be7-908f-5a47e72737d9}\BootstrapperSetup.exe" -uninstall -quiet -burn.related.upgrade'
shows that it is passing -uninstall and -quiet to BootstrapperSetup.exe which is in cache i.e. already installed there.
Here are the results of command line options passed to Bootstrapper:
C:\bin\Debug>BootstrapperSetup.exe -quite -uninstall
Command.Display: Full, Command.Action: Uninstall
C:\bin\Debug>>BootstrapperSetup.exe -q -uninstall
Command.Display: None Command.Action: Uninstall
C:\bin\Debug>>BootstrapperSetup.exe -q -u
Command.Display: None Command.Action: Install
Summary: From above test, it seems that
- -quite is not effective, while -q does.
- -u is not effective, while -Uninstall does.
Although, after knowing this, I can parse for -quite and -u in my Managed Bootstrapper, but I would like to know, If it is a Bug or I'm doing something wrong here.
Best regards
回答1:
It's not a bug. You must spell quiet correctly, it's not 'quite'. I believe the intent for the command line was to accept what msiexec would accept. msiexec does not use -u for uninstall (or anything as far as I can tell), but -q is used.
Unfortunately, the documentation on this is not very good. You'll have to read the WiX source code for a lot of things like this. You will find exactly what the engine will parse for you at src/burn/engine/core.cpp (the ParseCommandLine method).
来源:https://stackoverflow.com/questions/22011578/is-this-a-bug-in-wix-bootstrapper-command-line