2010-04-01 75 views
0

我安裝連同我的應用程序:
1)啓動和停止需要
2)實際包含用戶數據conf文件我的應用程序的服務並且會根據需要顯示給用戶進行修改(我給用戶在安裝期間通過運行notepad.exe和我的conf文件來更改它的機會)首先運行記事本my.cfg,然後才啓動該服務

問題是在我的代碼中,我安裝的服務啓動之前用戶有機會修改conf文件。我想的是:
1)首先,用戶得到改變conf文件(NOTEPAD.EXE與conf文件運行)
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文件運行記事本,然後啓動服務)。

回答

0

我會擴展MSI UI以詢問用戶需要修改的部分,然後使用XmlFile和XmlConfig元素更新文本文件。然後Windows安裝程序可以通過並啓動該服務。

+0

感謝您的回答。同時,我也發現了一些:我可以前的 「StartServices」 安排自定義操作 <自定義操作= 'LaunchConfFile' 以前= 'StartServices'>(不安裝)和(非UPGRADINGPRODUCTCODE) 似乎工作。 – 2010-04-06 08:38:01

+0

希望它也是正確的 – 2010-04-06 08:38:27

相關問題