invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Patch Family/Families

I've read the context help and I still don't understand Patch Families. Could you give me an example of why I must use them?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Patch Family/Families

Hello,

Here is the relevant section from the MSDN article explaining patch families:
Patches in the same patch family that target the same product version are sorted by the values in the Sequence column. The patches within the patch family are applied to the target product in the order of increasing sequence. The PatchFamily is also used to determine which patches are to be superseded. A patch may be listed in multiple rows and belong to multiple patch families if it applies to more than one product or includes multiple fixes.
For example, you have a product v1.1 installed on your machine. The latest product version however is v1.3. To upgrade to 1.3, you must apply a sequence of patches.
Patch 1.1 to 1.2 and patch 1.2 to 1.3 in that exact order. To ensure their correct order, they must belong to the same patch family and have a Sequence specified in the MsiPatchSequence table that specifies a sequence number based on which the sequence in which patches upgrading the target must be applied is determined.

This information is used by tools such as the MsiDeterminePatchSequence API to compare the patch to other patches and determine the order in which they must be applied to a target in order to successfully upgrade it.

You can also read MSDN's Sequencing Patches article for more information on patch sequences.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
skizzle
Posts: 9
Joined: Mon May 23, 2011 11:13 pm

Re: Patch Family/Families

Would it be possible for you to show a print screen of what the "Images" and "Patch Sequences" tabs would look like if you were creating a patch like you described in your example. I'm having a hard time trying to create a patch with this scenario. I keep getting compile errors and I'm not sure what I'm doing wrong. This is what I have: v1.0.0, v1.0.1, and v1.0.2. I have .msi's created for each of those and currently have v1.0.0 installed on my computer. I'm assuming my "Images" tab should look something like this: Family-> v1.0.1msi(Upgraded) with v1.0.0msi(Target) as a child. Then another family member with v1.0.2msi(Upgraded) with v1.0.0msi and v1.0.1msi as children. Is this correct? I've been trying a lot of different configurations of this and they all seem to either give me compile errors or if they do work I get a Windows Installer message when trying to run the latest .msp that I don't have the correct patch. Any help you could give me would be greatly appreciated.

Thanks,
Scott
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Patch Family/Families

Hi Scott,

A patch family is used when multiple patches can upgrade the same target version( e.g. you have v1.0.0 with two patches v1.0.1 and v1.0.2 that will both be applied on v1.0.0 ; in the same context v1.0.2 can supersede v.1.0.1 if configured accordingly from the Patch Sequence page ).

If you want a scenario where v1.0.0 is upgraded only by v1.0.1 and v.1.0.1 is upgraded only by v1.0.2 then the patches must not be in the same family. The structure should be:
Family 1
- v1.0.1 ( upgraded )
-- v1.0.0 ( target )
Family 2
- v1.0.2 ( upgraded )
-- v1.0.1 ( target )

Another cleaner method that would help you organize better, would be to create two separate patch projects for each patch instead of two families in one patch project.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
skizzle
Posts: 9
Joined: Mon May 23, 2011 11:13 pm

Re: Patch Family/Families

Mihai,

Thanks for the response. That makes sense. If I do use one patch as you described below with 2 families, then would I need to do anything with the patch sequences. I guess I'm still sorta confused where the patch sequences come into play. How do they fit into this scenario?

Thanks again,

Scott
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Patch Family/Families

Hi Scott,

The patch sequence can be set in the Patch Sequence page and it is relevant only when you have a family with multiple patches. Only then, you would need to sequence the patches within their specific family.

For more related information you can follow the links my colleague Gabriel included in his above post.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
skizzle
Posts: 9
Joined: Mon May 23, 2011 11:13 pm

Re: Patch Family/Families

Mihai,

Ok, I created a patch that has 2 families
Family 1
V1.0.1 (Upgraded)
V1.0.0 (Target)
Family 2
V1.0.2 (Upgraded)
V1.0.1 (Target)

This is my error log.

NFO: Using Pcp Path: [MyPatchPCPFilePath].pcp.
INFO: Using Temporary Directory: C:\Users\[UserProfile]\AppData\Local\Temp\~pcw_tmp.tmp.
INFO: Passed all of the main control parameter validation to PatchWiz, now calling the next 5 phases.
INFO: Phase I: Entered validation and processing phase.
INFO: Validation of Pcp.
INFO: MinimumRequiredMsiVersion is 200.
INFO: SEQUENCE_DATA_GENERATION_DISABLED is 1.
INFO: ListOfPatchGUIDsToReplace is .
INFO: ListOfTargetProductCodes is *.
INFO: MsiFileToUseToCreatePatchTables is .
INFO: PatchGUID is {A83CB4A7-3B06-4292-A143-911B26B48F70}.
INFO: PatchOutputPath is [MyPatchFilePath].msp.
INFO: PatchSourceList is PatchSourceList.
INFO: PATCH_CACHE_DIR is .
INFO: AllowDualPatch is 0.
INFO: AllowProductCodeMismatches is 0.
INFO: AllowProductVersionMajorMismatches is 1.
INFO: ApiPatchingSymbolFlags is 0.
INFO: DontRemoveTempFolderWhenFinished is 0.
INFO: IncludeWholeFilesOnly is 0.
INFO: PATCH_CACHE_ENABLED is 0.
INFO: OptimizePatchSizeForLargeFiles is 0.
INFO: META_DATA_GENERATION_DISABLED is 0.
INFO: TrustMsi is 0.
INFO: AllowLaxValidationFlags is 0.
ERROR: UpgradedImages.Upgraded = 'Enterprise_2': PackageCode {99048521-E1C3-487E-9981-FB2D93BE2313} is not unique.
ERROR: The Last Error Received is: 0
INFO: Temporary folder is about to be cleaned out and deleted: C:\Users\[UserProfile]\AppData\Local\Temp\~pcw_tmp.tmp
ERROR: Internal PatchWiz Error occurred.
ERROR: The Last Error Received is: -1072803501
error.
Exception - MsiMsp.exe failed to create the patch file.

Build finished because an error was encountered.


I'm really confused by this. From what I see it's telling my that I need a unique "PackageCode". Is that different than the ProductCode? If not then I thought that I cannot change the ProductCode for patch creation. If so then how do I make the the package code unique so I can have 2 families.

I have no idea what I'm doing wrong. Kinda frustrating. Any help you could give me would be greatly appreciated.

Thanks,
Scott
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Patch Family/Families

Hi Scott,

It seems you are using the same package for upgraded and target. Please review your patch project and make sure you have the correct source for each target and upgraded.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
skizzle
Posts: 9
Joined: Mon May 23, 2011 11:13 pm

Re: Patch Family/Families

I've double checked at least 3 times. I've started over that many times as well. I'm assuming that each time I change the Product Version from say 1.0.0 to 1.0.1, a new Package Code is supposed to be created correct? But the Product Code remains the same as long as I say "No" when prompted?

This is what I've done....
1.) Compiled my application exe using version 1.0.0...My AI project is Product Version 1.0.0.
2.) I compile and a MyInstaller.msi is created. I copy that msi to a safe location.
3.) I then change my application exe to version 1.0.1 and my AI project to Product Version 1.0.1. I say "No" when prompted to change Product Code.
4.) I compile my AI project a second time and a second MyInstaller.msi is created. I copy that msi to a safe location. (I now have 2 msi's).
5.) I create a new Patch Project in AI. Under the "Images" section I select my second MyInstaller.msi (1.0.1) as the Upgraded and my first MyInstaller.msi (1.0.0) as the Target.
6.) I compile this patch and everything compiles fine.
7.) I then change my application exe to version 1.0.2 and my AI project to Product Version 1.0.2. I say "No" when prompted to change Product Code.
8.) I compile and a third MyInstaller.msi is created. I copy that msi to a safe location. (I now have 3 msi's)
9.) I open up my existing Patch Project and add a second family under the "Images" section. I select my latest MyInstaller.msi (1.0.2) as the Upgraded and my second MyInstaller.msi (1.0.1) as the Target.

When compiling it is telling me that my Target in my second family is not unique. Is this because it is the same as the Upgraded of the first family? I've literally attempted this about 10 times and always produce the same results. Any help you could give me would be greatly appreciated. I'm in dire need of getting this installer running soon.

Thanks,
Scott
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Patch Family/Families

Hi Scott,

It seems I misinterpreted the usage of families in your particular case. Please disregard using families for your scenario.

Since you need two different .MSP files you can try the two patch projects approach I mentioned in one of my previous posts:
First patch project:
Family 1
V1.0.1 (Upgraded)
V1.0.0 (Target)
Second patch project:
Family 1
V1.0.2 (Upgraded)
V1.0.1 (Target)

This way you will have two .MSP patches to upgrade from one version to the next.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
skizzle
Posts: 9
Joined: Mon May 23, 2011 11:13 pm

Re: Patch Family/Families

Ok that makes more sense. So what do you think the best way is to manage what patches need installing? If a person is on v1.0.0 and patches v1.0.1 and v1.0.2 have been released, the app would need to download and apply both patches. I thought that's what patch families were for but maybe not.
Thanks,
Scott
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Patch Family/Families

Hi Scott,
So what do you think the best way is to manage what patches need installing? If a person is on v1.0.0 and patches v1.0.1 and v1.0.2 have been released, the app would need to download and apply both patches. I thought that's what patch families were for but maybe not.
Patch families are not intended for this functionality. Instead, you can achieve this with the help of the Advanced Installer Auto-Updater feature.
Here is the step by step tutorial to get you started. As this feature requires careful settings, I recommend you follow it before implementing the functionality into your main project. Also, here is the user guide article that explains the auto updater's command line options as well as other useful information.

If you find any difficulties using this feature please don't hesitate to contact us.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
R.Mueller
Posts: 202
Joined: Thu Aug 02, 2012 3:31 pm

Re: Patch Family/Families

Hi Mihai,

If I understand your recommendations correctly, there is no need to use patch families, when I want to supersede each previous version with one MSP file.
Let's say, I have 11.0.1 and a patched version 11.0.2. Now I want to patch both 11.0.1 and 11.0.2 to 11.0.3. Each patch will contain all files to be changed for the particular version including previous version changes.

If I use patch families and add both versions (11.0.1 and 11.0.2) as target image to the same family, I get the following error during build:

INFO: Phase IV: Entering Generate Payload.
INFO: Phase V: Entering Generate MSP.
INFO: Generating Patch Metadata.
ERROR: Failed to open a view
ERROR: The Last Error Received is: 0x64f (1615)
ERROR: The Last Error Received is: 1: 2228 2: C:\...\~pcw_tmp.tmp\inputcpy.pcp 3: MsiPatchSequence 4: SELECT `PatchFamily` FROM `MsiPatchSequence` WHERE `PatchFamily` = ? AND `ProductCode` = ?

But after deleting the patch families entries, I do not get any build errors anymore.

I assume, this is the correct way doing I am right here?

Regards,

Roland
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Patch Family/Families

Hello Roland,

In order to achieve what you want you can create two patch projects. First patch project can contain the following structure:
Family
-v 11.0.2 (upgraded)
--v 11.0.1 (target)

and the second one can have this structure:
Family
-v 11.0.3 (upgraded)
--v 11.0.1 (target)
--v 11.0.2 (target)

Also, if you want that your first patch to be removed by the second patch, then in the second patch project you should add the first patch in "Patches To Replace" section from "Patch Details" page.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Himanshu
Posts: 9
Joined: Thu Jul 28, 2016 2:24 pm

Re: Patch Family/Families

Please help ASAP.

I have followed the steps you mentioned in this post. For me Second patch installed/modified files does not uninstall/revert to patch 101.

Projects:
100
101
102

Patch Project Family101:
Family
-v 101 (upgraded)
--v 100 (target)

Patch Project Family102:
-v 102 (upgraded)
--v 100 (target)
--v 101 (target)
Attachments
PatchUninstall.zip
Second patch installed/modified files does not uninstall/revert to patch 101.
(140.02 KiB) Downloaded 403 times

Return to “Common Problems”