在我的 Windows WiX 安装程序中,我的自定义操作没有 运行

In my Windows WiX Installer my Custom Actions don't run

我想让 installer/uninstaller 删除包含应用程序在 运行 时生成的内容的文件夹。我认为自定义操作是可行的方法。

我们正在使用 WiX 3.6。

(出于对这个问题不重要的特定原因,我希望它出现在安装程序序列中。)

这是我在 xml:

中的 CustomAction 定义
<Binary Id="CustomActionLib" SourceFile="$(var.CustomActionLibrary.TargetDir)$(var.CustomActionLibrary.TargetName).CA.dll" />
<CustomAction Id="DeleteLocalizedCA" Impersonate="yes" BinaryKey="CustomActionLib" DllEntry="DeleteLocalized" Return="check" />
<CustomAction Id="DeleteResourcesCA" Impersonate="yes" BinaryKey="CustomActionLib" DllEntry="DeleteResources" Return="check" />

以下是我对它们的引用:

<InstallExecuteSequence>
  <Custom Action="DeleteLocalizedCA" Before="InstallFiles"/>
  <FindRelatedProducts Before="LaunchConditions" />
  <RemoveExistingProducts After="InstallFinalize" />
  <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>

<InstallUISequence>
  <Custom Action="DeleteLocalizedCA" Before="InstallFiles"/>
  <FindRelatedProducts Before="LaunchConditions" />
</InstallUISequence>

我将 CustomActionLibrary 项目添加到解决方案中,并从安装程序项目中添加了对它的引用,但它从未 运行s,我从未在日志中看到它,什么都没有!

因此我的问题是,为什么我的 WiX 自定义操作没有 运行?

经过几个小时的谷歌搜索和阅读(博客文章、文档、Whosebug 等)和测试,我终于找到了 none 我的阅读所指出的解决方案。

我必须放置一个 InstallExecuteSequence 以在包含 ComponentGroup 的片段中包含我的引用:

    <Fragment>
      <InstallExecuteSequence>
        <Custom Action="DeleteLocalizedCA" Before="InstallFiles">NOT Installed</Custom>
      </InstallExecuteSequence>
     <ComponentGroup Id='StringsComponents'>
       ...
     </ComponentGroup>
   </Fragment>

我之前放入 CustomAction 引用的 Fragment 只有步骤,但没有 Component 或 ComponentGroup,因此显然没有做任何事情。 (我不是安装程序的原作者,只是接替了一个无法帮助我的同事)。

希望这对遇到同样问题的其他人有所帮助。