【问题标题】:Empty wix 3.8 property value, without build warnings空 wix 3.8 属性值,没有构建警告
【发布时间】:2026-01-03 02:40:02
【问题描述】:

我有一个 wix 3.8 msi 安装程序。我怎样才能摆脱这个警告?

<Property Id="DB_USER" />
...
<Control Id="UserEdit" Type="Edit" X="45" Y="45" Width="200" Height="20" Property="DB_USER" Text="{80}" />

“UserEdit”控件初始化为空,但我收到以下构建警告:

Property 'DB_USER' does not contain a Value attribute and is not marked as Admin, Secure, or Hidden. The Property element is being ignored.

尝试 1:

<Property Id="DB_USER" Value=""/>

给出以下错误:

The Property/@Value attribute's value cannot be an empty string. If a value is not required, simply remove the entire attribute.

尝试 2:

<Property Id="DB_USER" Value="[THIS_PROPERTY_DOES_NOT_EXIST]"/>

使用字符串“[THIS_PROPERTY_DOES_NOT_EXIST]”初始化控件,而不是获取不存在的属性的值。

尝试 3:使用 CustomAction 清除 DB_USER 属性的内容,初始值为“-”。 CustomAction 在 InstallExecuteSequence 中描述为 After="CostFinalize"。属性保持为“-”

【问题讨论】:

  • 通过添加 Secure="yes",警告解决。但是,我不需要 SecureCustomProperties (msdn.microsoft.com/library/aa371571.aspx)。我应该将属性保留为安全只是为了摆脱警告,还是有更好的方法?
  • 为什么你认为你不需要它?

标签: wix windows-installer warnings


【解决方案1】:

您需要将该属性标记为安全。否则,您可能会遇到属性不会传递到服务器端的情况。 (托管/UAC 安装)。

【讨论】: