Error : Creating new installer using WiX toolset, for windows service. Not able to install the service. Getting an error
Error screenshot
I want to create a MSI which installs a Windows service.
Windows service gets installed and visible in services.msc
Stop and Remove the service.
My windows service has lot of dependencies which are to be used when running the service.
I have added all the files as component and added ServiceDependency
for each of the component ID also, but still not able to resolve the error. The error in the event viewer is also the same as the above screenshot.
Any pointers are most welcome.
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="LayoutSwitcher" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="LayoutSwitcher" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="PlcmLayoutSwitcherWinSvc.exe" Guid="PUT_GUID_HERE" KeyPath="yes">
<File Id="LayoutSwitcherWinSvc.exe"
Name="LayoutSwitcherWinSvc.exe" Source="$(var.LayoutSwitcherWinSvc_TargetDir)LayoutSwitcherWinSvc.exe" />
<CreateFolder />
<ServiceInstall Id="LayoutSwitcher" Type="ownProcess" Vital="yes"
Name="LayoutSwitcher" DisplayName="LayoutSwitcher"
Description="LayoutSwitcher" Start="auto" Account="NT AUTHORITY\LocalSystem"
ErrorControl="ignore" Interactive="no">
<ServiceControl Id="StartService" Start="install" Stop="both"
Remove="uninstall" Name="LayoutSwitcher" Wait="yes" />
</Component>
<Component Id="logoicon.ico" Guid="PUT_GUID_HERE">
<File Id="logoicon.ico" Name="logoicon.ico" Source="$(var.LayoutSwitcherWinSvc_ProjectDir)logoicon.ico" />
</Component>
<Component Id="LayoutSwitcherWinSvc.exe.config" Guid="PUT_GUID_HERE">
<File Id="LayoutSwitcherWinSvc.exe.config" Name="LayoutSwitcherWinSvc.exe.config" Source="$(var.LayoutSwitcherWinSvc_TargetDir)LayoutSwitcherWinSvc.exe.config" />
</Component>
<Component Id="Transactions.dll" Guid="PUT_GUID_HERE">
<File Id="Transactions.dll" Name="Transactions.dll" Source="$(var.LayoutSwitcherWinSvc_TargetDir)Transactions.dll" />
</Component>
<Component Id="Transactions.Cfg.dll" Guid="PUT_GUID_HERE">
<File Id=" Transactions.Cfg.dll" Name="Transactions.Cfg.dll" Source="$(var.LayoutSwitcherWinSvc_TargetDir) Transactions.Cfg.dll" />
</Component>
Updated the source code after removing the service dependency, but still getting the same error.
Removed the whitespaces, but still getting the same error.
Verbose logs attached. Please download from the below link.
http://www.yourfilelink.com/get.php?fid=1432133
Adding a WiX setup project In Visual Studio, open your solution, and add a WiX project to it: go to the Visual Studio main menu and click File -> Add -> New Project to open the Add New Project dialog. Choose the Setup Project item in the Windows Installer XML node, specify the project name and click OK.
Windows Installer XML Toolset (WiX, pronounced "wicks"), is a free software toolset that builds Windows Installer packages from XML. It consists of a command-line environment that developers may integrate into their build processes to build MSI and MSM packages.
You can also check in the Programs and Features section of Control Panel. If WiX Toolset is installed, it will be listed there. If you need to install WiX Toolset, you can download it from here.
Can you try this piece of wix code? I cleaned it a little bit to remove some default values.
Unless you want to place the file with a different filename you don't need the Name attribute.
If you want your service to run as Local System then you need to set empty Account. If you want it to run as a specific user then you could set the properties on your command line SVCACCOUNT=someuser SVCPASSWORD="password", otherwise just skip them.
If Name and Id is the same then you can skip the Id.
I prefer to use variables for things that I use in multiple places to avoid typos, for example ServiceName that is used in ServiceInstall and ServiceControl I use:
<WixVariable Id="ServiceName" Value="LayoutSwitcher" />
<Component Id="PlcmLayoutSwitcherWinSvc.exe" Guid="PUT_GUID_HERE">
<File Id="LayoutSwitcherWinSvc.exe" Source="$(var.LayoutSwitcherWinSvc_TargetDir)LayoutSwitcherWinSvc.exe" KeyPath="yes" />
<ServiceInstall Name="!(wix.ServiceName)"
DisplayName="LayoutSwitcher"
Description="LayoutSwitcher"
ErrorControl="ignore"
Type="ownProcess"
Vital="yes"
Start="auto"
Account="[SVCACCOUNT]"
Password="[SVCPASSWORD]"
Interactive="no" />
<ServiceControl Id="ServiceControl_!(wix.ServiceName)"
Name="!(wix.ServiceName)"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
The log you attached is incomplete, run the installer all the way through and attach the log only after you've closed the installer. IMO Debug log is not necessary.
Try making both of the Name attributes exactly the same in the install and the control. They need to match exactly and they don't. You're trying to start a non-existent service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With