How to Create a Patch in WiX with the different pr

2019-06-02 11:55发布

问题:

I use Purely WiX approach to making patches and am trying to make a single MSP work for 2 different MSI's. I have v1.1 MSI and v1.2 MSI, and plan to create an MSP using v1.2 MSI, so that the MSP can be used for both v1.1 and v1.2.

I set Validate/@ProductId='no' as its description says:

Requires that the installed ProductCode match the target ProductCode used to create the transform. The default is 'yes'.

However, it only works for v1.2. So far, the only way I was able to work was to add 2 TargetProductCode/@Id as below. Is this a bug for Validate/@ProductId? Or Is that the right way to do?

<Media Id="5000" Cabinet="RTM.cab" >
    <PatchBaseline Id="RTM" >
        <Validate ProductId='no' ProductLanguage='no' ProductVersion="Update" ProductVersionOperator='LesserOrEqual' UpgradeCode='no' />
    </PatchBaseline>
</Media>

<!-- Why do I need this when Validate/@ProductId='no'? -->
<TargetProductCodes Replace='no'>
    <TargetProductCode Id='{xxx}' />
    <TargetProductCode Id='{xxx}' />
</TargetProductCodes>

<PatchFamilyRef Id="myRollup"/>

There is a same question but both didn't work.

回答1:

I had the same issue, the Validate/@ProductId='no' doesn't seem to do much for me, unless I'm doing something wrong.

What I've found is you need to keep the ProductId the same for each update, and only change it for a major version upgrade (at which point there is no MSP to go from v1.x to v2.0, it's an upgrade install via an MSI).

Then you can build the MSP based on v1.0 and set ProductVersionOperator to GreaterOrEqual, or build it based on v1.1 and set it to LesserOrEqual, and the MSP's will work on any v1.x MSI.