【发布时间】:2013-07-29 11:02:50
【问题描述】:
我有一个数据驱动的自定义操作,我将它与表格数据一起定义在它自己的文件中。当我运行我的安装时,它失败了,因为缺少自定义表(我已经检查过 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 条目也是如此:
但自定义表无处可见。我确定我遗漏了一些明显的东西,但我看不出它是什么。可以吗?
【问题讨论】:
-
为您的自定义表格添加
EnsureTable元素:stackoverflow.com/questions/461907/… -
根据 Rob Mensching 对其中一个链接问题的回答,这不是必需的(从上面的源代码中可以看出,该表绝对不是空的)。但是,我认为我可能遇到了导致输出未更新的构建问题,因此我可能只是在查看旧输出。当我知道更多时,我会发布更新。
-
糟糕,我似乎在彻底阅读文本之前就发表了评论...抱歉。
标签: wix installation windows-installer custom-action wix3.7