我如何将WiX属性默认设置为null? [英] How can I have a WiX Property default to null?
问题描述
我正在研究一组WiX安装程序,它们将共享一种通用形式.每个应用程序都需要设置值,但是每个应用程序都将有所不同.
I am working on a set of WiX installers that are going to share a common form. Every application needs the values set, but they are going to be different for each application.
我试图允许属性(链接到控件)具有默认值(或不具有默认值),并允许通过命令行设置属性值.
I am trying to allow for the properties (which are linked to controls) to have a default value (or not) and to allow for the property values to be set via command line.
在我的"SharedDialog.wxs"中:
in my "SharedDialog.wxs" I have:
<Fragment>
<PropertyRef Id="PROP1"/>
<PropertyRef Id="PROP2"/>
<UI>
<Dialog Id="SharedDialog" Width="370" Height="270" Title="[ProductName]">
<Control Type="Edit" Id="1" Property="PROP1" Wid... Indirect="no" />
<Control Type="CheckBox" Id="2" Property="PROP2" Wid...
CheckBoxValue="1" Indirect="no"/>
</Dialog>
</Fragment>
在用于特定于应用程序的项目的文件中:
In a file for the application specific project:
<Fragment>
<Property Id="PROP1" Value="Test"/>
<Property Id="PROP2" Value="1"/>
</Fragment>
这一切都适用于我想做的事情,但是问题是当我想这样清除值时:(因此它们没有默认值)
This all works for what I am trying to do, but the problem is that when I want to clear the values as so: (so they don't have a default)
<Fragment>
<Property Id="PROP1"/>
<Property Id="PROP2"/>
</Fragment>
我收到此错误:
Unresolved reference to symbol 'Property:PROP1' in section 'Fragment:'.
Unresolved reference to symbol 'Property:PROP2' in section 'Fragment:'.
WiX还将不允许您将值设置为".问题是,据我所知,如果该属性具有值,将始终选中该复选框.如何将属性"PROP2"设置为空"?
WiX also will not let you set value to "". The problem is that as far I can tell the checkbox will always be checked if the property has a value. How can I set the property "PROP2" to "null"?
推荐答案
Nvm ...我找到了解决方法
Nvm... I found a solution
<Fragment>
<Property Id="PROP1" Secure="yes"/>
<Property Id="PROP2" Secure="yes"/>
</Fragment>
这篇关于我如何将WiX属性默认设置为null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!