Question

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.

Was it helpful?

Solution

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

OTHER TIPS

Well i ran into the same issues and after lot testing and debugging following all the advise on the internet, found myself helpless till i got to read this post.

In the web setup project, set the value of EDITA1 Value=[VARIABLE]. In custom action , customdata set /va=[EDITA1]

Now when you install the application through command line you need to set VARIABLE=data. When you run into the GUI, type the data in the textbox.

It works, i have tested and verified in the log file as well.

The issue is that the InstallExecuteSequence in the generated MSI file has some custom actions such as CustomTextA_SetProperty_EDIT1. If you look at this, it does in fact set the property value to null, even if you had specified it on the command line. To pass them from the command line into the MSI silently you'd need to edit the MSI file (for example with Orca) to:

  1. Delete the custom actions in the InstallExecuteSequence table with names like CustomTextA_SetProperty_EDIT1.

  2. In the Property table, the SecureCustomProperties value, add your edit properties all separated by colons. For example add ";EDITA1" to the existing list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top