简体   繁体   中英

Checkbox's value is changed from blank to true when run in cmdline with msiexec

I inherited a setup project, and when I try to run the msi file using msiexec in the commandline, and I leave the property, or specify it to be {}, then it gets changed back to '1' or true.

This is not the case when I run the msi with the GUI. If I leave the checkbox unchecked, it remains unchecked.

Here is an example of what I run in the commandline:

msiexec.exe /i D:\BeanLocalDev\Development\Setup2015.msi CHKVSEXTENSION={} /QN /L*V D:\BeanLocalDev\Development\Setup2015\Debug\log.txt

From the log file:

MSI (s) (F0:1C) [20:29:42:324]: Doing action: 
CustomCheckA_SetProperty_CHECKBOX2
MSI (s) (F0:1C) [20:29:42:325]: Note: 1: 2235 2:  3: ExtendedType 4: SELECT 
`Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` 
WHERE `Action` = 'CustomCheckA_SetProperty_CHECKBOX2' 
MSI (s) (F0:1C) [20:29:42:325]: PROPERTY CHANGE: Modifying CHKVSEXTENSION 
property. Its current value is '{}'. Its new value: '1'.
Action start 20:29:42: CustomCheckA_SetProperty_CHECKBOX2.
Action ended 20:29:42: CustomCheckA_SetProperty_CHECKBOX2. Return value 1.

How do I change this in Visual Studio in the Setup project?

You can't change it directly in the setup project. For some reason VS inserts custom actions to blank the values of the checkboxes early in the UI sequence and execute sequence. It doesn't matter in the UI sequence because it's BEFORE the values are entered, but in the execute sequence it blanks the values from the command line.

This means you'd need to alter the MSI file after the build (for example with Orca). In the InstallExexecuteSequence table there'll be a call to the custom action that resets your property, something like CustomCheckA_SetProperty_CHECKBOX1. If the name of your property is CHKVSEXTENSION then add a condition in the Condition row of NOT CHKVSEXTENSION which means it will reset it only if it's not already been set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM