[wix-users] Trying to understand Bootstrapping behavior with properties

Hoover, Jacob Jacob.Hoover at greenheck.com
Tue May 10 10:33:01 PDT 2022


A patch is just a modification of an existing install. https://docs.microsoft.com/en-us/windows/win32/msi/patch-packages

I would suggest you look into the remember me pattern (https://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/), as well, if it's designed to be serviced only by bundles, do your searches in the bundle and property drive the MSI/MSP installs.


From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Todd Hoatson via wix-users
Sent: Tuesday, May 10, 2022 12:06 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Todd Hoatson <todd.hoatson at gmail.com>
Subject: [wix-users] Trying to understand Bootstrapping behavior with properties

Apologies in advance for this long post...

We have an installer that works well for us, and we also use bootstrapping
to supply patches.

The installer allows the user to accept the default location for data files
(a.k.a. project files) or change the location. The actual location is
stored in the registry.

We recently realized that the patches were only using the default location
and not pulling the correct location from the registry, so if the user
accepted the default location, it worked well, but if the user had selected
an alternate location, that location was overwritten in the registry with
the default location, and the user was no longer to find the data files.

The relevant code for the base installer is:

<CustomAction Id='SetDefProjFolder' Property='DEFPROJFOLDER'
Value='[WindowsVolume]My App Projects' />
<Property Id="PROJFOLDERFOUND" Value="unset" />
<CustomAction Id="VerifyProjectPath"
Return="check"
Execute="immediate"
BinaryKey="CustomActions.CA.dll"
DllEntry="VerifyProjectPath" />

<CustomAction Id='UseDefProjFolder' Property='PROJFOLDER'
Value='[DEFPROJFOLDER]' />
<CustomAction Id='UseRegProjFolder' Property='PROJFOLDER'
Value='[REGPROJFOLDER]' />

<CustomAction Id='CheckUpgradeValue' Property='ISUPGRADE' Value='True'
/>
<CustomAction Id='CheckPatchValue' Property='ISPATCH' Value='True' />

<InstallUISequence>
<Custom Action="SetDefProjFolder"
After="FindRelatedProducts"></Custom>
<Custom Action="VerifyProjectPath" After="SetDefProjFolder"></Custom>
<Custom Action="UseDefProjFolder" After="AppSearch">NOT
REGPROJFOLDER</Custom>
<Custom Action="UseRegProjFolder"
After="AppSearch">REGPROJFOLDER</Custom>
</InstallUISequence>

The C# code for the custom action is:

[CustomAction]
public static ActionResult VerifyProjectPath(Session session)
{
session.Log("Begin VerifyProjectPath in custom action dll");
string regProjPath = GetProjectDirFromRegistry();
session.Log("ProjectPath from Registry: " + regProjPath);
if (string.IsNullOrEmpty(regProjPath))
{
session["REGPROJFOLDER"] = null;
session["PROJFOLDERFOUND"] = "NotFound";
return ActionResult.Success;
}

session["REGPROJFOLDER"] = regProjPath;

if (Directory.Exists(regProjPath) &&
Directory.GetFiles(regProjPath).Length > 0)
session["PROJFOLDERFOUND"] = "AlreadyExisting";
else
session["PROJFOLDERFOUND"] = "InvalidRegEntry";

return ActionResult.Success;
}

As I mentioned above, all this works great for the base installer. Note
that both DEFPROJFOLDER and REGPROJFOLDER are set, and there is logic to
choose which one to use.

For the patch, I tried adding the following code to our bootstrap installer:

<Property Id="PROJFOLDER">
<RegistrySearch Id='RegistryDataFolder' Root='HKLM'
Key='SOFTWARE\Wow6432Node\My App'
Name='Settings_Directory' Type='directory'/>
</Property>

Note that there is no mention of DEFPROJFOLDER here, nor is it mentioned
anywhere else in the bootstrap installer wix code. Similarly, there is no
mention of the SetDefProjFolder or VerifyProjectPath custom actions.

However, when I install a text patch with logging turned on, I see this:

Action 15:32:48: SetDefProjFolder.
Action start 15:32:48: SetDefProjFolder.
MSI (c) (A4:8C) [15:32:48:122]: PROPERTY CHANGE: Adding DEFPROJFOLDER
property. Its value is 'C:\My App Projects'.
Action ended 15:32:48: SetDefProjFolder. Return value 1.

How can this be in the patch log when it is not in the patch code?

I also see this in the log:

Begin VerifyProjectPath in custom action dll
MSI (c) (A4!1C) [15:32:48:245]: PROPERTY CHANGE: Adding REGPROJFOLDER
property. Its value is 'C:\Temp Projects\My App Projects\'.
MSI (c) (A4!1C) [15:32:48:246]: PROPERTY CHANGE: Modifying
PROJFOLDERFOUND property. Its current value is 'unset'. Its new value:
'AlreadyExisting'.
Action ended 15:32:48: VerifyProjectPath. Return value 1.

So that proves that the C# is being invoked, and the proper value is being
retrieved from the registry. But wait - VerifyProjectPath IS NOT MENTIONED
IN THE PATCH CODE!!! How is this possible?

In addition, I also see this:

Action 15:32:48: UseRegProjFolder.
Action start 15:32:48: UseRegProjFolder.
MSI (c) (A4:8C) [15:32:48:294]: PROPERTY CHANGE: Adding PROJFOLDER
property. Its value is 'C:\Temp Projects\My App Projects\'.
Action ended 15:32:48: UseRegProjFolder. Return value 1.

And this proves that the registry value has been selected over the default
value.

But later in the log file I find this line:

MSI (c) (A4:8C) [15:32:48:528]: PROPERTY CHANGE: Modifying PROJFOLDER
property. Its current value is 'C:\Temp Projects\My App Projects\'. Its new
value: 'C:\My App Projects'.

And then again:

MSI (c) (A4:8C) [15:32:48:576]: PROPERTY CHANGE: Modifying PROJFOLDER
property. Its current value is 'C:\My App Projects'. Its new value: 'C:\My
App Projects\'.

And twice more for good measure:

MSI (s) (18:E4) [15:32:52:850]: PROPERTY CHANGE: Modifying PROJFOLDER
property. Its current value is 'C:\My App Projects\'. Its new value: 'C:\My
App Projects'.
...
MSI (s) (18:E4) [15:32:52:866]: PROPERTY CHANGE: Modifying PROJFOLDER
property. Its current value is 'C:\My App Projects'. Its new value: 'C:\My
App Projects\'.

Can anyone help me understand how this is happening? Where is this coming
from if it is not in the patch code...?

thanks,

Todd Hoatson
Mobile: 763-291-3312
Email: todd_hoatson at sil.org<mailto:todd_hoatson at sil.org> <todd.hoatson at gmail.com<mailto:todd.hoatson at gmail.com>>


--
Todd Hoatson
Mobile: 763-291-3312
Email: todd.hoatson at gmail.com<mailto:todd.hoatson at gmail.com>
www.linkedin.com/in/toddhoatson<http://www.linkedin.com/in/toddhoatson>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/<http://www.firegiant.com>
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.



More information about the wix-users mailing list