views:

25

answers:

1

I have a project that uses the wix extension WixUtilExtension to create a user for our windows services. When I patch the installation (using an .msp), the custom actions RemoveUser and CreateUser are executed.

I don't want these wix extension created custom actions to run during a patch.

I can add a condition directly to the custom action (ConfigureUsers) in the InstallExecuteSequence table of the msi to prevent this, but have not found a way to handle this in wix.

Using wix, how can I prevent RemoveUser and CreateUser from being executed during a patch?

<util:Group Id="LocalAdministrators" Name="Administrators"/>
<DirectoryRef Id="INSTALLLOCATION" DiskId="1">   
  <Component Id="CreateServiceAccountUser" Guid="{614550A7-C766-4B5D-9BF9-233D07EB3B69}">

    <util:User  Id="ServiceAccountUser"   CanNotChangePassword="yes" CreateUser="yes" Disabled="no" FailIfExists="no" LogonAsService="yes" Name="TestUser" Password="testuserpw" PasswordExpired="no" PasswordNeverExpires="yes" RemoveOnUninstall="yes" UpdateIfExists="yes">
      <util:GroupRef Id="LocalAdministrators"/>
    </util:User>

    <RegistryKey Root="HKMU" Key="Software\AMT\WebBrix">
      <RegistryValue Name="CreateServiceAccountUser" Value="Common" Type="string" KeyPath="yes" />
    </RegistryKey>

  </Component>
</DirectoryRef>
A: 

You can do that in wix,

<InstallExecuteSequence>
    <Custom Action='ConfigureUsers' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>

here are some more conditions

  1. Action run only during Install Condition: NOT Installed AND NOT PATCH
  2. Action only runs during removal of MSI Condition: REMOVE
  3. Action runs during Install and repair Condition: NOT REMOVE
  4. Action runs during Install and remove Condition: There must be no condition
  5. Action calls EXE installed by MSI Condition:NOT Installed AND NOT PATCH
  6. Run on initial installation only: NOT Installed
  7. Run on initial install or when repair is selected. NOT Installed OR MaintenanceMode="Modify"
  8. Run when being uninstalled from command line or add / remove menu. REMOVE~="All" OR MaintenanceMode="Remove"
Charles Gargent
Will this overwrite the entry the wix custom action writes directly to the msi InstallExecuteSequence table?There is no entry for this custom action in the InstallExecuteSequence tag. It looks like the wix custom action adds it directly to the msi InstallExecuteSequence table.
Dan Haavisto
If I understand you correctly then no, this just specifies when and if the action should occur.
Charles Gargent
To be a little more clear perhaps:I used the wix WixUtilExtension library to create a user and did not add an entry for the ConfigureUsers custom action to the InstallExecuteSequence tag. I did't know this custom action was created and added directly to the msi InstallExecuteSequence table without a conditional until I checked the table. I took your suggestion and added the entry for the ConfigureUsers custom action to the InstallExecuteSequence tag and rebuilt the msi. The existing row in the msi InstallExecuteSequence table was updated to include the conditional.
Dan Haavisto
I thought I had this fixed after I added the CA conditional you suggested:<InstallExecuteSequence> <Custom Action='ConfigureUsers' After='InstallFinalize'>NOT Installed</Custom></InstallExecuteSequence>The ConfigureUsers CA and the other Custom actions it calls are defined as inscript and run immediately but when I add the conditional you suggested, they execute deferred with the error:"DEBUG: Error 2762: Unable to schedule operation. The action must be scheduled between InstallInitialize and InstallFinalize."I think I'm back where I started. I need to not run these CAs on a patch
Dan Haavisto
I think I found it. <Custom Action='ConfigureUsers' After='InstallFinalize'>NOT Installed</Custom>Needs to be "Before='InstallFinalize'"
Dan Haavisto