¿Cómo instalo un servicio con algunos archivos adicionales en WiX y defino qué archivo es el archivo EXE del servicio real?Instalación de un servicio NT de múltiples archivos usando WiX (2.0)
Escenario: tuve un servicio que era sólo un único archivo EXE, y se instala como un servicio de Windows NT en WiX con este código:
<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>
y tenía una característica que luego permitirá instalar y opcionalmente comenzar este servicio.
Ahora, mi problema es que ahora mi servicio ha crecido, y el único EXE ya no es un único EXE, son múltiples archivos, EXE, DLL y algunos archivos de soporte.
Sin embargo, ¿cómo puedo instalar eso ahora?
traté de tener un componente con todos mis archivos
<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>
En primer lugar, he intentado sólo tiene que añadir el ServiceInstall y etiquetas Servicecontrol a este componente:
<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>
pero entonces mi "Marco. dll "se establece como la ruta de origen para el servicio que se está creando ........
Así que pensé en crear un segundo componente para instalar el servicio, usando ServiceInstall , y me limitaría a hacer referencia a ese archivo EXE de servicio utilizando FileRef, pero eso no parece existir (al menos en 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>
Por lo tanto - lo que es un pobre tiene que WiX autor no instalar todos los archivos necesarios, y aún así obtener la instalación de servicio de NT para recoger el archivo EXE correcta (no cualquier archivo arbitrario de la lista del componente de archivos) ??
Marc
Olvidó establecer KeyPath = 'yes' en el exe en el elemento File. –
Gracias, Shay - La respuesta de Rob parece confirmar su afirmación, ¡muy apreciada! –