patching using purely WIX

孤街醉人 提交于 2019-12-05 02:53:25

问题


I am struggling with creating a patch purely using WIX and I was hoping if someone could guide me in the right direction.

I have a few hundred source files and I run heat against them to create a harvest file followed by creating a package using candle and light.

I need to change a few configuration files and I create a 2nd package with the changes.

Using Torch and pyro I create the .wixmst file and then when trying to create the msp file, pyro complains with the following error.

pyro.exe : error PYRO0252 : No valid transforms were provided to attach to the patch. Check to make sure the transforms you passed on the command line have a matching baseline authored in the patch. Also, make sure there are differences between your target and upgrade.

my question really is: what should patch.wxs contain?

Here is what my patch.wxs looks like:

<?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>

I am using Wix patching as described in this link: http://wix.sourceforge.net/manual-wix3/wix_patching.htm

However, it doesn't consider source wix file created using heat. Can someone tell me what am I doing wrong here?


回答1:


Hitesh,

For me heat creates a component group like this:

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

heat command:

"%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

And in patch.wxs:

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

Take care: there is no ProductCode attribute in PatchFamily tag




回答2:


I faced the same issue, the fix for this error is to add the GUID to the component and it should remain same for both the versions of 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>




回答3:


I would also like to mention that PatchFamily elements are optional when building a patch, and are intended to allow fine grained control over exactly what will get patched. In most cases I find that I want to include all differences between 2 versions of an MSI when building a patch, in which case I omit the PatchFamily altogether. In your case, the resulting patch WXS would look like the following:

<?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>

I hope this answer helps anyone with a similar question, that is not wanting to manually construct patch families, not wanting to manually includeComponentRef every time they need to build a patch.



来源:https://stackoverflow.com/questions/10305897/patching-using-purely-wix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!