Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用属性值的WIX自定义操作条件无效_Wix_Custom Action_Wix3.11 - Fatal编程技术网

使用属性值的WIX自定义操作条件无效

使用属性值的WIX自定义操作条件无效,wix,custom-action,wix3.11,Wix,Custom Action,Wix3.11,我试图在Wix安装程序的末尾运行一个自定义操作,但只有在满足某些条件的情况下。用户运行安装程序,他们将选择设置属性“ServiceType”的两种模式之一。属性的两个值是“RegisterNew”和“LinkExisting”。从下面的日志可以看出,当用户在UI中选择“LinkExisting”时,它会更改属性,但自定义操作仍在运行 MSI (c) (D4:44) [11:20:15:686]: PROPERTY CHANGE: Modifying ServiceType property. I

我试图在Wix安装程序的末尾运行一个自定义操作,但只有在满足某些条件的情况下。用户运行安装程序,他们将选择设置属性“ServiceType”的两种模式之一。属性的两个值是“RegisterNew”和“LinkExisting”。从下面的日志可以看出,当用户在UI中选择“LinkExisting”时,它会更改属性,但自定义操作仍在运行

MSI (c) (D4:44) [11:20:15:686]: PROPERTY CHANGE: Modifying ServiceType property. Its current value is 'RegisterNew'. Its new value: 'LinkExisting'.
以下是我的自定义操作代码:

<InstallExecuteSequence>
  <Custom Action="RegisterServiceNameCustomAction" Before="InstallFinalize">
    <![CDATA[(ServiceType="RegisterNew") AND (NOT Installed)]]>
  </Custom>
</InstallExecuteSequence>

  <Fragment>
    <Binary Id="RegisterServiceCustomActionBinary" SourceFile="$(var.RegisterServiceCustomAction.TargetDir)$(var.RegisterServiceCustomAction.TargetName).CA.dll" />
    <CustomAction Id="RegisterServiceNameCustomAction" BinaryKey="RegisterServiceCustomActionBinary" DllEntry="ShowRegisterService" Execute="deferred" Return="check" />
  </Fragment>

以下是我尝试过的不同条件:

(ServiceType="RegisterNew") AND (NOT Installed)

<![CDATA[(ServiceType="RegisterNew") AND (NOT Installed)]]>

ServiceType="RegisterNew" AND NOT Installed
(ServiceType=“RegisterNew”)和(未安装)
ServiceType=“RegisterNew”且未安装
下面是“我的自定义”对话框的代码,在该对话框中,他们正在选择将更改“ServiceType”的选项:


1.
以下是UI的图像:


所以我的问题是,为什么它会执行自定义操作,即使我的条件是专门检查该属性

在阅读了一些文档并查看了WIX中标记的所有“属性”之后,我决定尝试设置一些其他值,看看发生了什么。我发现,在定义属性时,如果将其标记为安全,那么它会在整个安装过程中保留其值,而如果它不安全,则似乎不会这样做。现在我的属性定义如下所示:

<Property Id="SERVICE_TYPE" Secure="yes" Value="RegisterNew" />

您会注意到,我必须将名称更改为call caps,因为当您将属性标记为安全属性时,名称中不能有任何小写字母

以下是WIX文档中的一个片段:

Secure--YesNoType--表示在使用提升的权限执行托管安装时,可以将属性传递给服务器端。有关详细信息,请参阅SecureCustomProperties属性

<Property Id="SERVICE_TYPE" Secure="yes" Value="RegisterNew" />