Friday, May 25, 2007

How to use WIX's ServiceInstall to install Windows Service?

In continuation of my previos post ( How to create an installer using WIX ... )...
Following is code snippet for using ServiceInstall in WIX...



<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="832B8322-6349-4ddd-8AC6-CF18E7A05509" Name="DotNetService"
Language="1033" Version="1.0.0.0" Manufacturer="Persistent"
UpgradeCode="6493A097-BA2D-482b-9EDD-2BDBC3E5463E">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="WixServiceInstaller.cab" EmbedCab="yes" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='DOTNETSERVICE' Name='DotNet'>
<Component Id="InstallService" Guid='AAA67783-EEF0-453f-BBAF-E02B1341E3BC'>
<File Id="WindowsService" Name="WixServiceInstaller.exe"
Source="WixServiceInstaller.exe" KeyPath="yes"/>
<ServiceInstall Id="ABC"
Name="WixServiceInstaller"
DisplayName="WixServiceInstaller"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Description="WixServiceInstaller"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]" />
<ServiceControl Id="StartWixServiceInstaller"
Name="WixServiceInstaller" Start="install" Wait="no" />
<ServiceControl Id="StopWixServiceInstaller" Name="WixServiceInstaller"
Stop="both" Wait="yes" Remove="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='TheOnlyFeature' Description='Feature contains the single component'
Level='1'>
<ComponentRef Id='InstallService'/>
</Feature>
</Product>
</Wix>



Suggested Link:
Installing Services using Wix-
http://blogs.madtechnology.net/blogs/chris/archive/2007/05/04/684.aspx

7 comments:

Anonymous said...

Nvin Installer is a simple installer developed using WiX toolset. It is really useful if somebody don't want scratch their head to create MSI files.

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Elisabeth Yusnita said...

Hi ,

Please advice how if i need the dialog wizard from installed service show up during installation.
Example :
I need to install apache tomcat (this is supporting tools for my app). and beside only execute i need the dialog wizard from apache tomcat application show up.. so i can configure it.
Many thanks

Ayyanar said...

I have used and tried the steps that mentioned in this page. But I got the error when i am trying to install that created msi "InstallUtil.dll: Unknown Error"

Can you tell me the solution for this problem?

Thanks in advance...

Dave Hamdan said...

Thanks for the article. As a note: adding the node in Windows 8.1 caused many headaches. I don't have time right now to research why, but it made the service get 'stuck' during the uninstall process requiring manual removal of the service, reboots, etc.

Google