如何在WiX中安裝帶有一些附加文件的服務,並定義實際的服務EXE文件是什麼文件?使用WiX安裝多文件NT服務(2.0)
場景:我這只是一個單一的EXE文件的服務,並將其安裝在維克斯Windows NT服務使用此代碼:
<Component Id='InstallMyServiceComponent' Guid='{....}' DiskId='1'>
<File Id='InstallMyServiceEXEFile' LongName='MyService.exe'
Name='MyServ.exe' src='MyService/bin/release/MyService.exe' KeyPath='yes'/>
<ServiceInstall Id='InstallMyService' Name='MyService' Description='My Service'
ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes' />
<ServiceControl Id='UninstallMyService' Name='MyService' Remove='uninstall'
Wait='yes' />
</Component>
<Component Id='RunMyServiceComponent' Guid='.......'>
<ServiceControl Id='RunMyService' Name='MyService' Start='install'
Stop='uninstall' Wait='no' />
</Component>
,我有一個功能,那麼這將允許安裝並可選擇啓動此服務。
現在,我的問題是 - 現在我的服務增長了,單個EXE不再是單個EXE - 它是多個文件,EXE,DLL和一些支持文件。
但是,我現在怎麼安裝?
我想有一個component,我的所有文件
<Component Id="MyService" Guid="......" DiskId="1">
<File Id="fileMyService_framework_dll" LongName="Framework.dll"
Name="Framewrk.DLL" src="MyService\Framework.dll" />
<File Id="fileMyService_dal_dll" LongName="MyServiceDAL.dll"
Name="SrvcDAL.DLL" src="MyService\ServiceDAL.dll" />
<File Id="fileMyService_helpers_dll" LongName="Helpers.dll"
Name="Helpers.DLL" src="MyService\Helpers.dll" />
<File Id="fileMyService_exe" LongName="MyService.exe"
Name="MySrv.EXE" src="MyService\MyService.exe" />
</Component>
首先,我想只是添加則ServiceInstall和的ServiceControl標籤這個組件:
<Component Id="MyService" Guid="......" DiskId="1">
<File Id="fileMyService_framework_dll" LongName="Framework.dll"
Name="Framewrk.DLL" src="MyService\Framework.dll" />
<File Id="fileMyService_dal_dll" LongName="MyServiceDAL.dll"
Name="SrvcDAL.DLL" src="MyService\ServiceDAL.dll" />
<File Id="fileMyService_helpers_dll" LongName="Helpers.dll"
Name="Helpers.DLL" src="MyService\Helpers.dll" />
<File Id="fileMyService_exe" LongName="MyService.exe"
Name="MySrv.EXE" src="MyService\MyService.exe" />
<ServiceInstall Id='InstallMyService' Name='MyService'
Description='My Service' ErrorControl='normal' Start='auto'
Type='ownProcess' Vital='yes' />
<ServiceControl Id='UninstallMyService' Name='MyService'
Remove='uninstall' Wait='yes' />
</Component>
但後來我的「框架。 DLL「被設置爲創建服務的源路徑........
所以我想創建第二個組件來實際安裝服務,使用ServiceInstall ,我只是使用FileRef引用該服務EXE文件 - 但似乎並不存在(至少在Wix2中)。
<Component Id='InstallMyServiceComponent' Guid='{....}' DiskId='1'>
<FileRef Id='fileMyService_exe' KeyPath='yes'/>
<ServiceInstall Id='InstallMyService' Name='MyService'
Description='My Service' ErrorControl='normal' Start='auto'
Type='ownProcess' Vital='yes' />
<ServiceControl Id='UninstallMyService' Name='MyService'
Remove='uninstall' Wait='yes' />
</Component>
所以 - 什麼是貧窮的WiX筆者所要做的安裝所有必要的文件,並仍然得到NT Service安裝拿起從文件中的組件列表中選擇正確的EXE文件(不只是任意文件)??
馬克
您忘記在File元素的exe中設置KeyPath ='yes'。 – 2009-08-12 14:02:12
謝謝,謝 - 羅布的回答似乎證實了你的說法 - 非常感謝! – 2009-08-12 20:29:23