WIX v4 无法在自定义元素属性条件中引用功能的操作状态

huangapple go评论59阅读模式
英文:

WIX v4 Unable to reference action state of a feature in the custom element property condition

问题

当尝试向操作的"Install Execute Sequence"添加自定义操作条件时,如果引用功能的操作状态时使用了"&",则构建将失败。

在构建时,出现以下错误:
错误 WIX0104:不是有效的源文件;详细信息:'&'是一个意外的令牌。期望的令牌是';'。

但是,"&Main;" 不是一个已定义的实体。

我认为在条件中的"&Main"之后需要一个分号,因为条件已移至属性,并且我认为XML解析器期望它。因此,我不确定这是否是版本4中的一个错误,还是是否应该有一种新的标记来匹配这个功能,这在这里有文档记录:

FireGiant表达式语法

我无法找到关于Wixtoolset版本4的条件属性实现的任何文档,因为现有文档目前没有提供任何解释。

Wixtoolset自定义元素

英文:

When trying to add a custom action condition to the Install Execute Sequence of that action. The build will fail when the action state of a feature is referenced via the '&'.

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <Package Name="New App" Manufacturer="Coder" Version="1.0.0.0" Scope="perMachine" UpgradeCode="56858172-dbce-452f-855c-2c24cc44a192">
    <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
    <MediaTemplate EmbedCab="true"/>
    
    <Property Id="POWERSHELL" Value="powershell.exe"/>
    <CustomAction Id="PsInstallSkdTasks" Property="POWERSHELL" Return="asyncNoWait" ExeCommand="-File "[INSTALLFOLDER]\InstallScheduledTasks.ps1"" />
    <InstallExecuteSequence>
      <Custom Action="PsInstallSkdTasks" OnExit="success" Condition="(?CompPsIns = 3) AND ((!Main = 3) OR (&Main = 3))" />
    </InstallExecuteSequence>
    
    <Feature Id="Main" Level="1" AllowAdvertise="false" Display="expand" Title="Main App" Description="Descr...">
      <ComponentGroupRef Id="CompGrpMain" />
    </Feature>
  </Package>
</Wix>

When I attempt to build this I get the following error:
error WIX0104: Not a valid source file; detail: ' ' is an unexpected token. The expected token is ';'.

But then '&Main;' is not a defined entity.

I believe it wants a semicolon after &Main in the condition because the condition has been moved to a property and I believe the XML parser is expecting it. So I'm not sure if this is a bug in version 4 or if there is meant to be a new notation to match this functionality that is documented here:

FireGiant Expression Syntax

I've been unable to find any documentation of the implementation of the condition property for version 4 of the Wixtoolset, as the existing documentation provides no explanations at this time.

Wixtoolset Custom Element

答案1

得分: 0

你不能在XML中使用裸露的&。请使用&代替。

英文:

You can't use a naked & in XML. Use & instead.

huangapple
  • 本文由 发表于 2023年2月7日 00:34:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364094.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定