visual-studio-2010windows-installersetup-projectweb-setup-project

Overriding "Textboxes" dialog fields from the command line in MSI installer (Visual Studio 2010 Web Setup)


Background

I have a Web Setup project in Visual Studio 2010.

In the User Interface section, I have a custom Textboxes dialog. These text fields have property names like EDITA1, EDITA2.

I have a Custom Action which makes use of these properties:

CustomActionData = /foo="[EDITA1]" /bar="[EDITA2]" /zip="[BLARB]"

In the code for handling this custom action, these parameters are available in the Context.Parameters dictionary

public override void Install(System.Collections.IDictionary stateSaver) {
    string foo = Context.Parameters["foo"]; // originates in edit box EDITA1
    string bar = Context.Parameters["bar"]; // originates in edit box EDITA2
    string zip = Context.Parameters["zip"];

Problem

I want to be able to run the installer from a script, without a UI, so I need to pass in values for foo and bar via the command line. The way you're supposed to do this is by appending PROPERTY=VALUE to your MSI command line, like this:

msiexec /qn /i MyInstaller.msi EDITA1=John EDITA2=Smith BLARB=Donut

But this doesn't work. Custom parameters which aren't associated with custom text fields do show up. For instance, BLARB gets passed through just fine (Parameters["zip"]=="Donut"). But properties which are associated with the text fields do not show up, as if they are being nuked by the empty (but hidden) dialog box before my custom install function is called.


Solution

  • It is not the dialog which overrides the property values. A log file will help you determining what causes the property value change.