无法将我的 WiX 自定义操作安排到 msi 中
Unable to schedule my WiX Custom Action into the msi
我在 visual studio 中有一个安装程序解决方案,其中包含 C# windows 应用程序引导程序和两个 msi 项目。我想在卸载序列期间为两个 msis 中的一个安排自定义操作 运行 - 所以我首先将 CustomActions 项目添加到同一解决方案(称为 "CustomActions"),该解决方案具有 CustomAction.cs 定义要安排的自定义函数的文件。此函数现在应该只向日志文件写入一些内容:
namespace CustomActions
{
public class CustomActions
{
[CustomAction]
public static ActionResult UninstallSecondaryMsi(Session session)
{
session.Log("Begin CustomAction1");
/* Search for ProductCode of the secondary msi here; run msiexec to uninstall it */
return ActionResult.Success;
}
}
我将 CustomActions 项目引用添加到我的 msi 项目,然后将以下内容添加到我的 product.wxs:
<!-- Custom Actions -->
<Fragment>
<Binary Id="customActionDLL" SourceFile="$(var.CustomActions.TargetDir)\CustomActions.CA.dll" />
<CustomAction Id="CustomAction_GetRegistryKey"
BinaryKey="customActionDLL"
DllEntry="UninstallSecondaryMsi"
Execute="immediate"
Return="check" />
<InstallExecuteSequence>
<Custom Action="CustomAction_GetRegistryKey"
After="InstallFinalize"></Custom>
</InstallExecuteSequence>
</Fragment>
我 运行 触发 msi 的引导程序,但 "Begin CustomAction1" 字符串不在日志文件中。我想也许这不仅仅是正确的日志记录,但是当我使用 Orca.exe 查看生成的 msi 时,我看到我的自定义操作 没有 安排在 CustomActions table 或 InstallExecuteSequence table.
我在这里遗漏了什么吗?我还猜测 CustomActions.CA.dll 的路径不正确,并尝试对 DLL 的路径进行硬编码,但这也不起作用。任何帮助将不胜感激,提前致谢!
啊,我的自定义操作元素在主 Product.wxs 文件中,但在不同的片段中,并且该片段没有在任何地方被引用。我在该 Fragment 下放置了一个 ComponentGroup,并在 Feature 元素下引用了它的 ID - 它起作用了。抱歉。
我在 visual studio 中有一个安装程序解决方案,其中包含 C# windows 应用程序引导程序和两个 msi 项目。我想在卸载序列期间为两个 msis 中的一个安排自定义操作 运行 - 所以我首先将 CustomActions 项目添加到同一解决方案(称为 "CustomActions"),该解决方案具有 CustomAction.cs 定义要安排的自定义函数的文件。此函数现在应该只向日志文件写入一些内容:
namespace CustomActions
{
public class CustomActions
{
[CustomAction]
public static ActionResult UninstallSecondaryMsi(Session session)
{
session.Log("Begin CustomAction1");
/* Search for ProductCode of the secondary msi here; run msiexec to uninstall it */
return ActionResult.Success;
}
}
我将 CustomActions 项目引用添加到我的 msi 项目,然后将以下内容添加到我的 product.wxs:
<!-- Custom Actions -->
<Fragment>
<Binary Id="customActionDLL" SourceFile="$(var.CustomActions.TargetDir)\CustomActions.CA.dll" />
<CustomAction Id="CustomAction_GetRegistryKey"
BinaryKey="customActionDLL"
DllEntry="UninstallSecondaryMsi"
Execute="immediate"
Return="check" />
<InstallExecuteSequence>
<Custom Action="CustomAction_GetRegistryKey"
After="InstallFinalize"></Custom>
</InstallExecuteSequence>
</Fragment>
我 运行 触发 msi 的引导程序,但 "Begin CustomAction1" 字符串不在日志文件中。我想也许这不仅仅是正确的日志记录,但是当我使用 Orca.exe 查看生成的 msi 时,我看到我的自定义操作 没有 安排在 CustomActions table 或 InstallExecuteSequence table.
我在这里遗漏了什么吗?我还猜测 CustomActions.CA.dll 的路径不正确,并尝试对 DLL 的路径进行硬编码,但这也不起作用。任何帮助将不胜感激,提前致谢!
啊,我的自定义操作元素在主 Product.wxs 文件中,但在不同的片段中,并且该片段没有在任何地方被引用。我在该 Fragment 下放置了一个 ComponentGroup,并在 Feature 元素下引用了它的 ID - 它起作用了。抱歉。