So I've spent a lot of time looking at this, with no luck so far.  It looks 
like my problem is that states change during the execution, and there is no way 
for me to get the following behavior:

1.       On first install, run my custom action to install the service

2.       On uninstall, run my custom action to remove the service

3.       On an "upgrade" with a different package GUID, don't run any of my 
custom actions.

But it never quite works.  Looks like internally, it's doing 2 "INSTALL"s.  
Below is the tasks running.  Since everything runs multiple times, it seems 
impossible to write the proper conditions to get the desired behavior.  I 
thought I had it, but for some reason some of the properties I'm setting are 
getting lost between the 2 installs.
Action start 22:24:25: INSTALL.
Action start 22:24:25: AppSearch.
Action start 22:24:25: FindRelatedProducts.
Action start 22:24:25: ValidateProductID.
Action start 22:24:25: CostInitialize.
Action start 22:24:25: FileCost.
Action start 22:24:25: CostFinalize.
Action start 22:24:25: MigrateFeatureStates.
Action start 22:24:25: CustomizeDlg.
Action start 22:24:27: ExecuteAction.
Action start 22:24:29: INSTALL.
Action start 22:24:29: AppSearch.
Action start 22:24:29: FindRelatedProducts.
Action start 22:24:29: ValidateProductID.
Action start 22:24:29: CostInitialize.
Action start 22:24:29: FileCost.
Action start 22:24:29: CostFinalize.
Action start 22:24:29: BNSPathReplaceLive1.
Action start 22:24:29: BNSPathReplaceLive2.
Action start 22:24:29: RelmanDSNReplaceLive1.
Action start 22:24:29: RelmanDSNReplaceLive2.
Action start 22:24:29: InspectUnInstallServiceAction.
MSI (s) (40:68) [22:24:29:816]: PROPERTY CHANGE: Adding NOUNINSTALLSERVICE 
property. Its value is '1'.
Action start 22:24:29: MigrateFeatureStates.
Action start 22:24:29: InstallValidate.
Action start 22:24:29: InstallInitialize.
Action start 22:24:30: ProcessComponents.
Action start 22:24:30: UnpublishFeatures.
Action start 22:24:30: RemoveRegistryValues.
Action start 22:24:30: RemoveFiles.
Action start 22:24:30: RemoveFolders.
Action start 22:24:30: CreateFolders.
Action start 22:24:30: InstallFiles.
Action start 22:24:30: WriteRegistryValues.
Action start 22:24:30: RegisterUser.
Action start 22:24:30: RegisterProduct.
Action start 22:24:30: PublishFeatures.
Action start 22:24:30: PublishProduct.
Action start 22:24:30: InstallFinalize.
Action start 22:24:30: RemoveExistingProducts.
Action start 22:24:30: INSTALL.
Action start 22:24:30: AppSearch.
Action start 22:24:30: FindRelatedProducts.
Action start 22:24:30: ValidateProductID.
Action start 22:24:30: CostInitialize.
Action start 22:24:30: FileCost.
Action start 22:24:30: CostFinalize.
Action start 22:24:30: BNSPathReplaceLive1.
Action start 22:24:30: BNSPathReplaceLive2.
Action start 22:24:30: RelmanDSNReplaceLive1.
Action start 22:24:30: RelmanDSNReplaceLive2.
Action start 22:24:30: MigrateFeatureStates.
Action start 22:24:30: InstallValidate.
Action start 22:24:30: InstallInitialize.
Action start 22:24:31: ProcessComponents.
Action start 22:24:31: UnpublishFeatures.
Action start 22:24:31: RemoveRegistryValues.
Action start 22:24:31: UnInstallServiceAction.    <-- this shouldn't run!!  
NOUNINSTALLSERVICE is getting lost somewhere!
Action start 22:24:31: RemoveFiles.
Action start 22:24:31: RemoveFolders.
Action start 22:24:31: CreateFolders.
Action start 22:24:31: InstallFiles.
Action start 22:24:31: WriteRegistryValues.
Action start 22:24:31: RegisterUser.
Action start 22:24:31: RegisterProduct.
Action start 22:24:31: PublishFeatures.
Action start 22:24:31: PublishProduct.
Action start 22:24:31: InstallFinalize.
Action start 22:24:31: RemoveExistingProducts.

Here's my current actions:
    <CustomAction Id="InstallServiceAction" FileKey="BuildServicesHost.exe_64" 
ExeCommand="register" Return='check' Impersonate='no' Execute="deferred"/>
    <CustomAction Id="UnInstallServiceAction" 
FileKey="BuildServicesHost.exe_64" ExeCommand="unregister" Return='check' 
Impersonate='no' Execute="deferred"/>
   <CustomAction Id="InspectInstallServiceAction" Property="INSTALLSERVICE" 
Value="1" />
   <CustomAction Id="InspectUnInstallServiceAction" 
Property="NOUNINSTALLSERVICE" Value="1" />

And my current sequence:
   <InstallExecuteSequence>
      <!-- install the service when the state of the controller feature is not 
present (2), but the action
           state of the controller feature is 3 (present on local computer) -->
      <Custom Action="InspectInstallServiceAction" 
After="CostFinalize">(<![CDATA[ &Relman4=3 ]]>) AND (NOT 
BSHOSTSERVICEIMAGE)</Custom>
      <Custom Action="InspectUnInstallServiceAction" 
After="CostFinalize">(NOUNINSTALLSERVICE=1) OR (NOT BSHOSTSERVICEIMAGE) OR 
<![CDATA[ (&Relman4 <> 2) ]]> </Custom>
      <Custom Action="InstallServiceAction" 
Before="InstallFinalize">INSTALLSERVICE</Custom>
      <Custom Action="UnInstallServiceAction" Before="RemoveFiles">NOT 
NOUNINSTALLSERVICE</Custom>

      <!-- For upgrades, we need RemoveExistingProducts to remove the previous 
version -->
      <RemoveExistingProducts After='InstallFinalize' />

   </InstallExecuteSequence>

Jason

From: Jason Shay
Sent: Wednesday, October 10, 2007 11:20 PM
To: Rob Mensching; wix-users@lists.sourceforge.net
Subject: RE: [WiX-users] WIX to install Services, but upgrade resets 
username/password

I took the approach of no longer using the ServiceInstall tag to install the 
service.  I'm using an evil custom action to call the installed service 
executable with a 'register' parameter when the feature is installed, and with 
'unregister' when the feature is uninstalled.  My desired "upgrades" scenario 
(with a new product GUID) is that neither an install or an uninstall will be 
triggered.

But with these conditions:
      <Custom Action="InstallServiceAction" 
After="InstallFinalize">(&amp;Relman4=3) AND (!Relman4=2)</Custom>
      <Custom Action="UnInstallServiceAction" 
Before="RemoveFiles">(&amp;Relman4=2) AND (!Relman4=3)</Custom>

An "upgrade" with a new product GUID does both the uninstall, and then the 
install.  Which is odd, since I don't see how both actions can occur unless the 
values of &Relman4 and !Relman4 are changing during the uninstall/re-install 
process?  Here's an example log of my upgrade scenario.  The uninstall and 
install service actions should never run.  Looks like the conditions are each 
evaluated twice, which I wouldn't expect.
MSI (s) (44:9C) [22:47:25:874]: Skipping action: UnInstallServiceAction 
(condition is false)
=============================
Action ended 22:47:27: RemoveRegistryValues. Return value 1.
MSI (s) (44:60) [22:47:27:671]: Doing action: UnInstallServiceAction
Action 22:47:27: UnInstallServiceAction.
Action start 22:47:27: UnInstallServiceAction.
Action ended 22:47:42: UnInstallServiceAction. Return value 1.
MSI (s) (44:60) [22:47:42:686]: Doing action: RemoveFiles
=============================
Action ended 22:47:42: RemoveExistingProducts. Return value 0.
MSI (s) (44:60) [22:47:42:780]: Skipping action: InstallServiceAction 
(condition is false)
=============================
Action ended 22:47:42: RemoveExistingProducts. Return value 1.
MSI (s) (44:9C) [22:47:42:811]: Doing action: InstallServiceAction
Action 22:47:42: InstallServiceAction.
Action start 22:47:42: InstallServiceAction.
Action ended 22:47:58: InstallServiceAction. Return value 1.
Action ended 22:47:58: INSTALL. Return value 1.

Here's my entire sequence:
   <InstallExecuteSequence>
      <!-- install the service when the state of the controller feature is not 
present (2), but the action
           state of the controller feature is 3 (present on local computer) -->
      <Custom Action="InstallServiceAction" 
After="InstallFinalize">(&amp;Relman4=3) AND (!Relman4=2)</Custom>
      <Custom Action="UnInstallServiceAction" 
Before="RemoveFiles">(&amp;Relman4=2) AND (!Relman4=3)</Custom>

      <!-- For upgrades, we need RemoveExistingProducts to remove the previous 
version -->
      <RemoveExistingProducts After='InstallFinalize' />

   </InstallExecuteSequence>

   <InstallUISequence>
       <Show Dialog="CustomizeDlg" After="MigrateFeatureStates"></Show>
   </InstallUISequence>

I'm guessing I just have the wrong condition for my actions, but I'm at a loss 
about how to get this right.

Jason


From: Rob Mensching
Sent: Friday, September 21, 2007 6:02 PM
To: Jason Shay; wix-users@lists.sourceforge.net
Subject: RE: [WiX-users] WIX to install Services, but upgrade resets 
username/password

Nothing like that exists natively in the Windows Installer.  You'd need to read 
the existing settings then put them back.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Shay
Sent: Thursday, September 20, 2007 16:19
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] WIX to install Services, but upgrade resets 
username/password

I've got a component with a windows service executable (it's the Key), and a 
<ServiceInstall> tag as follows:

<ServiceInstall Id="ServiceID" Name="BsHost" DisplayName="Service Display Name" 
Description="Service Description" ErrorControl="normal" Start="auto" 
Type="ownProcess" Vital="yes">

The problem is, when I put out a new version (not an upgrade package, but 
"upgrading" via a fresh product GUID), the settings to the service are set back 
to default.  My desired behavior is that if the user has changed the 
Account/Password for the service manually, I don't want to overwrite that.

Ideally, I want something like "if the service already exists, don't change 
anything".  Note that I can't query the user for username/password, as this 
install needs to support unattend, and the user triggering this install doesn't 
necessarily know the password that the service was configured to run as (if the 
user modified it manually).

Any ideas?

Jason
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to