我编写了一个 C#/DTF ICE 框架,并在博客上写了一篇关于它的文章:
MSI 提示:使用 C#/DTF 创作 ICE
实际源代码可在以下位置下载:
使用 C#/DTF 编写 ICE
WiX 没有每个说的“CUB”元素,但我能够让它“足够接近”。我记得与 Rob 的电子邮件交流,要求在 WiX 中提供官方支持,但回复充其量是中立的。
以下是可用源代码的片段:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="c3252df2-a757-4874-8dc6-0e235f130818" Name="Cub" Version="1.0.0.0" Language="1033" Manufacturer="Cub">
<Package InstallerVersion="200" Compressed="yes"/>
<Binary Id="ICE" SourceFile="$(var.Tests.TargetDir)$(var.Tests.TargetName).CA.dll"></Binary>
<CustomAction Id="ICE_DE_10" BinaryKey="ICE" DllEntry="ICE_DE_10"/>
<CustomAction Id="ICE_DE_20" BinaryKey="ICE" DllEntry="ICE_DE_20"/>
<CustomTable Id="_ICESequence">
<Column Id="Action" PrimaryKey="yes" Type="string" Width="72" Category="Identifier" Description="Name of ICE action to invoke" Modularize="Column" />
<Column Id="Condition" Type="string" Width="255" Nullable="yes" Category="Condition" Description="Optional expression which skips the ICE action if evaluates to expFalse."/>
<Column Id="Sequence" Type="int" Width="2" Nullable="yes" MinValue="0" MaxValue="32767" Description="Number that determines the sort order in which the ICE actions are to be executed." />
<Row>
<Data Column="Action">ICE_DE_10</Data>
<Data Column="Condition"></Data>
<Data Column="Sequence">10</Data>
</Row>
<Row>
<Data Column="Action">ICE_DE_20</Data>
<Data Column="Condition"></Data>
<Data Column="Sequence">20</Data>
</Row>
</CustomTable>
<AdminUISequence>
<CostInitialize Suppress="yes"/>
<FileCost Suppress="yes"/>
<CostFinalize Suppress="yes"/>
<ExecuteAction Suppress="yes"/>
</AdminUISequence>
<AdminExecuteSequence >
<CostInitialize Suppress="yes"/>
<FileCost Suppress="yes"/>
<CostFinalize Suppress="yes"/>
<InstallValidate Suppress="yes"/>
<InstallInitialize Suppress="yes"/>
<InstallAdminPackage Suppress="yes"/>
<InstallFiles Suppress="yes"/>
<InstallFinalize Suppress="yes"/>
</AdminExecuteSequence>
<AdvertiseExecuteSequence>
<CostInitialize Suppress="yes"/>
<CostFinalize Suppress="yes"/>
<InstallValidate Suppress="yes"/>
<InstallInitialize Suppress="yes"/>
<PublishFeatures Suppress="yes"/>
<PublishProduct Suppress="yes"/>
<InstallFinalize Suppress="yes"/>
</AdvertiseExecuteSequence>
<InstallUISequence>
<CostInitialize Suppress="yes"/>
<FileCost Suppress="yes"/>
<CostFinalize Suppress="yes"/>
<ValidateProductID Suppress="yes"/>
<ExecuteAction Suppress="yes"/>
</InstallUISequence>
<InstallExecuteSequence>
<CostInitialize Suppress="yes"/>
<FileCost Suppress="yes"/>
<CostFinalize Suppress="yes"/>
<ValidateProductID Suppress="yes"/>
<InstallValidate Suppress="yes"/>
<InstallInitialize Suppress="yes"/>
<InstallFinalize Suppress="yes"/>
<PublishFeatures Suppress="yes"/>
<PublishProduct Suppress="yes"/>
<ProcessComponents Suppress="yes"/>
<UnpublishFeatures Suppress="yes"/>
<RegisterUser Suppress="yes"/>
<RegisterProduct Suppress="yes"/>
</InstallExecuteSequence>
</Product>
</Wix>
我还执行以下操作作为构建后事件(将 MSI 复制到 CUB)
<PostBuildEvent>copy "$(TargetPath)" "$(TargetDir)$(TargetName).cub"
del "$(TargetPath)"</PostBuildEvent>