When I delete my service, I receive an error message stating that I must stop such and such a service before uninstalling. This is unsatisfactory - the uninstaller should automatically stop it.
I found a blog or news posting this month ago and made it work correctly, but now it stops working for me. And I don’t have a link to the message ... maybe someone else knows where it is? :) I think I changed some subtle things and it stopped working. I find Wix extremely difficult to fix.
I use the following include to retrieve the X_ WIN_ SERVICE_ NAME property (sorry I do not know how to avoid escaping here) from the registry. It does not matter during installation, because in this case I explicitly install it using the input file. This parameter is used before any components in my wxs file.
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?ifndef SetupXWinServiceRegistryProperties ?> <?define SetupXWinServiceRegistryProperties ?> <?define XWinServiceRegistryKey='Software\X\Y'?> <Property Id="X_WIN_SERVICE_NAME"> <RegistrySearch Id="XWinServiceNameSearch" Root="HKLM" Key="$(var.XWinServiceRegistryKey)" Name="ServiceName" Type="raw"/> </Property> <?endif?> </Include>
The following component includes a component for storing registry values during installation:
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?ifndef WriteXWinServiceRegistryProperties ?> <?define WriteXWinServiceRegistryProperties ?> <Component Id="CompWriteXWinServiceRegistryProps" Guid="some guid"> <RegistryValue Root="HKLM" Key="$(var.XWinServiceRegistryKey)" Name="ServiceName" Type="string" Value="[X_WIN_SERVICE_NAME]" Action="write" /> </Component> <?endif?> </Include>
I checked my system after installation, and the registry value is correctly written there. The part of my component where the service is configured looks like this:
<ServiceInstall Id="ServiceInstallXWinService" Name="[X_WIN_SERVICE_NAME]" Start="auto" DisplayName="xxx" Description="yyy" Account="[X_WIN_SERVICE_USER]" Password="[X_WIN_SERVICE_PASSWORD]" Type="ownProcess" ErrorControl="normal" Vital="yes" /> <ServiceControl Id="ServiceInstallXWinService" Name="[X_WIN_SERVICE_NAME]" Stop="both" Remove="uninstall" Wait="yes" />
Any ideas?
wix windows-services wix3
evilfred
source share