首先用my.cfg运行记事本,然后启动服务

时间:2010-04-01 13:48:16

标签: service wix

我随申请一起安装:
1)根据需要启动和停止我的应用程序的服务
2)一个conf文件,其中包含实际的用户数据,并将显示给用户以根据需要进行修改(我通过在安装过程中使用conf文件运行notepad.exe,让用户有机会更改它)

问题在于,在我的代码中,我安装的服务在用户有机会修改conf文件之前启动。我想要的是:
1)首先用户有机会更改conf文件(使用conf文件运行notepad.exe)
2)之后才启动服务

<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>  

我在上面的代码中做错了什么?我怎样才能改变它以实现我的需要? (首先用我的conf文件运行记事本,然后启动服务)。

1 个答案:

答案 0 :(得分:0)

我会扩展MSI UI以询问用户需要修改的部分,然后使用XmlFile和XmlConfig元素更新文本文件。然后,Windows安装程序可以启动并启动该服务。