Wix创建了cub文件

时间:2011-02-17 06:15:05

标签: wix windows-installer wix3.5 installshield-2010

我有一个问题,我使用wix创建一个cub文件,但是当我尝试对使用InstallShield创建的MSI运行它时,我得到以下错误:

  

CUB文件之间的致命架构冲突   和数据库。无法执行   评价。

我已经查看了installshield msi和cub中的模式,它看起来与一些列在cub中的long int(4)和msi中的short int(2)有关。 / p>

有没有办法改变wix如何在标准表上设置架构,如媒体,文件,CustomActions等?

或者是否有一种自动方式我可以通过脚本调整MSI的架构?

2 个答案:

答案 0 :(得分:1)

我已经编写了一个C#/ DTF ICE框架,我在以下网址发表了博客:

MSI Tip: Authoring an ICE using C# / DTF

实际源代码可从以下网址下载:

Authoring an ICE using C# / DTF

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>

另外,我将以下内容作为post build事件(将MSI复制到CUB)

    <PostBuildEvent>copy "$(TargetPath)" "$(TargetDir)$(TargetName).cub"
del "$(TargetPath)"</PostBuildEvent>

答案 1 :(得分:0)

以下脚本修复了该问题。看来Wix创建了一个媒体和文件表,如果架构不同,Windows安装程序就不喜欢它。如此简单的解决方案是在wix创建cub文件作为后期构建操作后删除两个表。

Const msiOpenDatabaseModeTransact = 1

Dim installer
Dim db
Dim view
Set installer = CreateObject("WindowsInstaller.Installer")
Set db = installer.OpenDatabase("Wix\Release\UnitTest.cub", msiOpenDatabaseModeTransact)
Set view = db.OpenView("DROP TABLE `File`")
view.Execute
view.close

Set view = db.OpenView("DROP TABLE `Media`")
view.Execute
view.close

Set view = nothing
db.commit
Set db = nothing
相关问题