我有一个数据驱动的自定义操作,我将它与表数据一起定义在它自己的文件中。当我运行我的安装时,它失败了,因为缺少自定义表(我已经检查过 Orca,它不存在)。
我意识到需要以某种方式引用该片段,并且我已经注意到问题10339055和6344608中的建议。
按照6344608中的建议,我将自定义操作定义移动到与表数据相同的片段中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)\Config.wxi?>
<Fragment>
<CustomTable Id="AscomDeviceProfiles">
<Column Id="ProgId" Type="string" PrimaryKey="yes" Category="Text" />
<Column Id="ChooserName" Type="string" />
<Row>
<Data Column="ProgId">ASCOM.Driver.Type</Data>
<Data Column="ChooserName">$(var.InstallName)</Data>
</Row>
</CustomTable>
<!-- Define the custom actions that will process the above table data -->
<Binary Id="binRegAscomDeviceProfiles" SourceFile="$(var.Wix.RegisterAscomDeviceProfiles.TargetDir)\$(var.Wix.RegisterAscomDeviceProfiles.TargetName).CA.dll" />
<!-- Register and check the return code - must run as "immediate" in order to access session data -->
<CustomAction Id="caRegisterAscomDeviceProfiles" BinaryKey="binRegAscomDeviceProfiles" DllEntry="RegisterAscomDeviceProfiles" Execute="immediate" Return="check" />
<!-- Unregister and ignore return code (allows uninstall to succeed even if ASCOM is broken) -->
<CustomAction Id="caUnregisterAscomDeviceProfiles" BinaryKey="binRegAscomDeviceProfiles" DllEntry="UnregisterAscomDeviceProfiles" Execute="immediate" Return="ignore" />
</Fragment>
</Wix>
在我的Product.wxs
文件中,我通过调度它来引用自定义操作,如下所示:
<InstallExecuteSequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWERPRODUCTFOUND AND NOT Installed</Custom>
<RemoveExistingProducts Before='InstallInitialize' />
<!-- Elevate to admin if required -->
<Custom Action='IsPrivileged' Before='LaunchConditions'>Not Privileged</Custom>
<!-- Create ASCOM device profiles during install finalize phase, but not if already installed -->
<Custom Action="caRegisterAscomDeviceProfiles" Before="InstallFinalize">NOT Installed</Custom>
<!-- Remove ASCOM device profiles during uninstall (but not maintenance mode) -->
<Custom Action="caUnregisterAscomDeviceProfiles" Before="RemoveFiles">REMOVE ~= "ALL"</Custom>
</InstallExecuteSequence>
这会正确地引入自定义操作,并在输出 MSI 文件中创建二进制文件,InstallExecuteSequence
条目也是如此:
但是自定义表无处可寻。我确定我遗漏了一些明显的东西,但我看不出它是什么。你能?