使用纯WIX进行补丁安装

5

我正在努力使用WIX创建补丁,希望有人能指导我正确的方向。

我有几百个源文件,并使用heat对它们进行处理以创建收集文件,接着使用candle和light创建包。

我需要更改一些配置文件,并创建第二个带有这些更改的包。

使用Torch和pyro我创建了.wixmst文件,但在尝试创建msp文件时,pyro报错如下:

pyro.exe:错误PYRO0252:未提供有效的转换以附加到补丁。请确保您在命令行中传递的转换与补丁中已经编写的基线匹配。另外,请确保目标和升级之间存在差异。

我的问题是:patch.wxs应该包含什么内容?

这是我的patch.wxs的内容:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <Patch 
        AllowRemoval="yes"
        Manufacturer="sample llc" 
        MoreInfoURL="sample.com"
        DisplayName="Env Patch" 
        Description="Env Specfic Patch" 
        Classification="Update"
        >

        <Media Id="5000" Cabinet="RTM.cab">
            <PatchBaseline Id="RTM" />
        </Media>

        <PatchFamilyRef Id="EnvPatchFamily" />
    </Patch>

    <Fragment>    
        <PatchFamily Id='EnvPatchFamily' Version='1.0.0.0' ProductCode="PUT-GUID-HERE" Supersede='yes' >

            ********************************************** 
                What component Ref should I put in here
                heat creates a component group and I can't
                put ComponentGroupRef in here
            **********************************************

    </PatchFamily>
    </Fragment>
</Wix>

我正在使用Wix补丁,如此链接所述: http://wix.sourceforge.net/manual-wix3/wix_patching.htm。 然而,它并没有考虑使用heat创建的源Wix文件。请问有人可以告诉我这里出了什么问题吗?
3个回答

5

Hitesh,

对我而言,热量会创建一个组件组,如下所示:

<Fragment>
    <ComponentGroup Id="MyFiles">
        <ComponentRef Id="cmp2AA1A30564C621322ECB3CDD70B1C03C" />
        <ComponentRef Id="cmp788C978F16E473D4FD85720B5B75C207" />
    </ComponentGroup>
</Fragment>

heat命令:

"%WIX%\bin\heat.exe" dir slndir\bin\Release -cg MyFiles -gg -scom -sreg -sfrag -srd -dr INSTALLDIR -out ..\Wix\MyFiles.wxs -var var.BinOutputPath -nologo -v -ke  -t wixtransform.xsl

在patch.wxs文件中:

<Fragment>    
    <PatchFamily Id='ProductPatchFamily' Version='1.3.0.0' Supersede='yes'>
        <ComponentRef Id="cmp2AA1A30564C621322ECB3CDD70B1C03C" />
        <ComponentRef Id="cmp788C978F16E473D4FD85720B5B75C207" />
    </PatchFamily>
</Fragment>

注意:PatchFamily标签中没有ProductCode属性。

是的,你说得对,关于ProductCode我已经把它移除了。但我的问题实际上是关于PatchFamily元素应该放什么内容,后来我发现它不需要包含任何内容。无论如何,感谢你的回复。我会接受你的答案,因为你指出了要删除ProductCode属性。谢谢。 - soothsayer
2
抱歉,我匆忙之中错过了patch.wxs文件被隐藏的事实。如果您将其留空,则此补丁将升级所有不同的文件。否则,它只会升级您选择的内容。 - MariusCC

2

我还想提到,当构建补丁时,PatchFamily元素是可选的,并且旨在允许精细控制要修补的内容。在大多数情况下,我发现在构建补丁时希望包括两个版本之间的所有差异,因此我完全省略了PatchFamily。在您的情况下,生成的补丁WXS如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Patch 
        AllowRemoval="yes"
        Manufacturer="sample llc" 
        MoreInfoURL="sample.com"
        DisplayName="Env Patch" 
        Description="Env Specfic Patch" 
        Classification="Update"
    >
        <Media Id="5000" Cabinet="RTM.cab">
            <PatchBaseline Id="RTM" />
        </Media>
    </Patch>
</Wix>

我希望这个答案能够帮助到那些与此类似的问题,他们不想手动构建补丁家族,也不想每次需要构建补丁时都手动包含ComponentRef


0

我遇到了同样的问题,解决此错误的方法是将 GUID 添加到组件中,并且在 msi 的两个版本中应保持相同。

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="WixPatch" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="WixPatch" />
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER" >
         <Component Id="File1" **Guid="3A64BE7A-BBEC-40AD-8319-45C602734146"**>
     <File Source="D:\V2\File1.txt" Name="File1" KeyPath="yes" DiskId="1" Id="F1"/>
         </Component>

</ComponentGroup>
</Fragment>


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接