views:

98

answers:

1

Hi all,

I install along with my application:
1) a service that starts and stops my application as needed
2) a conf file that contains actually the user data and that will be shown to the user to modify as needed (I give the user the chance to change it by running notepad.exe with my conf file during installing)

The problem is that in my code the service I install starts before the user had the chance to modify the conf file. What I would like is:
1) first the user gets the chance to change the conf file (run notepad.exe with the conf file)
2) only afterward start the service

<Component Id="MyService.exe" Guid="GUID">   
 <File Id="MyService.exe" Source="MyService.exe" Name="MyService.exe" KeyPath="yes" Checksum="yes" />  
 <ServiceInstall Id='ServiceInstall' DisplayName='MyService' Name='MyService' ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes'/>  
 <ServiceControl Id='ServiceControl' Name='MyService' Start='install' Stop='both' Remove='uninstall'/>  
</Component>  

<Component Id="my.conf" Guid="" NeverOverwrite="yes">  
 <File Id="my.cfg" Source="my.cfg_template" Name="my.cfg" KeyPath="yes" />  
</Component>  

[...]  

<Property Id="NOTEPAD">Notepad.exe</Property>  
<CustomAction Id="LaunchConfFile" Property="NOTEPAD" ExeCommand="[INSTALLDIR]my.cfg" Return="ignore" Impersonate="no" Execute="deferred"/>  
<!--Run only on installs-->  
<InstallExecuteSequence>  
 <Custom Action='LaunchConfFile' Before='InstallFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE)</Custom>  
</InstallExecuteSequence>  

What am I doing wrong in the above code and how could I change it in order to achieve what I need? (first run notepad with my conf file and then start the service).

TIA,
Viv

A: 

I would extend the MSI UI to ask for the parts the user needs to modify and then update the text file using XmlFile and XmlConfig elements. Then Windows installer can come by and start the service.

Christopher Painter
Thanks for the answer. Meanwhile I also found something: I could schedule the custom action before the "StartServices" <InstallExecuteSequence> <Custom Action='LaunchConfFile' Before='StartServices'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE)</Custom> </InstallExecuteSequence>Seems to be working.
Viv Coco
hope it's also correct
Viv Coco