I have an installer with ListBox and Add/Remove buttons on one of dialogs.
Items to ListBox adds and removes thru my CAs.
Microsoft.Deployment.WindowsInstaller.View listBoxView = session.Database.OpenView("select * from ListBox where Property = '" + listBoxProperty + "'");
listBoxView.Execute(null);
int count = 0;
while (listBoxView.Fetch() != null)
count++;
Record newListBoxRecord = new Record(4);
newListBoxRecord[1] = listBoxProperty;
newListBoxRecord[2] = ++count;
newListBoxRecord[3] = listItemValue;
newListBoxRecord[4] = listItemValue;
ICollection<ValidationErrorInfo> errors = listBoxView.ValidateNew(newListBoxRecord);
if (errors == null)
listBoxView.Modify(ViewModifyMode.InsertTemporary, newListBoxRecord);
The items adds and removes successfully, but later I need to store them in application config file. Deffered action doesn’t have access to Installer Database, so I used Immediate action after InstallFinalize. But when I read ListBox table it is empty. I supose it happens because of InsertTemporary modify mode. Insert mode gives me “Function failed during execution. Database: Table(s) Update failed.” error.
When you leave this wizard page, save the list to a property, with a separator character.
Deferred actions have access to a special property
CustomActionData, so that you can write them to config file during install phase.Using immediate action after
InstallFinalizehas a downside that you can’t write to protected system areas, like Program Files. Only deferred actions can be run elevated.