我的 WiX 遇到问题安装程序。
我有一个自定义对话框,其中包含链接到属性的编辑控件。在运行时,如果我更改编辑控件中的值,我会从日志中看到该属性已正确更新为该新值。但似乎,当InstallUISequence最后,该属性被重置为其默认值,这很烦人,因为我无法在 InstallExecuteSequence 的自定义操作部分中使用用户提交的值.
这是我使用的 WXS 脚本的摘录:
<UI>
<Dialog Id="select_list" Width="370" Height="270" Title="Select license and list files">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="UIBannerBmp" />
<Control Id="BannerLine" Type="Line" X="0" Y="45" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Type="Edit" Id="list" Width="211" Height="15" X="128" Y="128" Property="pListFile" />
<Control Type="Text" Id="static_list" Width="78" Height="17" X="41" Y="154" Text="list file" />
<Control Type="PushButton" Id="next" Width="50" Height="17" X="232" Y="244" Text="Next >">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Type="PushButton" Id="cancel" Width="50" Height="17" X="296" Y="244" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Type="Text" Id="desc" Width="348" Height="16" X="8" Y="90"
Text="Please set the path of the the list file" />
</Dialog>
<InstallUISequence>
<Show Dialog="select_list" After="WelcomeEulaDlg">NOT installed</Show>
</InstallUISequence>
</UI>
<CustomAction Id="InstallService"
ExeCommand="[bin]prog.exe -f install.cl '[pListFile]'"
Execute="immediate"
Return="check"
Directory="bin" />
<InstallExecuteSequence>
<Custom Action="InstallService" After="InstallFinalize">REMOVE=""</Custom>
</InstallExecuteSequence>
<CustomActionRef Id="InstallService" />
<Property Id="pListFile" Value="c:\" />
我一定不能在两个序列之间交换信息的正确轨道上。
有没有办法做到这一点?
最佳答案
您需要将属性标记为“安全”以使其从客户端 (InstallUISequence) 传递到服务器端 (InstallExecuteSequence)。为此,您需要将属性设为“公开”(全部大写)并确保安全。像这样:<Property Id="PLISTFILE" Secure="yes"/>
您不需要给它一个值,除非您希望默认情况下在您的 UI 中显示某些内容。
关于WiX:InstallUISequence 和 InstallExecuteSequence 之间的属性值丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1334721/