Manoj Rawat
2015-06-24 08:33:29 UTC
Hi,
I created shortcut for my windows service . When I uninstall the windows
service using shortcut then it removes service from startup menu, But I was
able to see the window service in services.msc tool (Note: it throws error
when I try to start\stop the particular win service ). If i uninstall it
from control panel's Add/Remove programes then it removes win service from
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestWindowService" Language="1033" Version="1.0.0.0"
Manufacturer="Test Service"
UpgradeCode="8cfc33c6-292f-4bad-a488-4781ae709c5e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is
already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="TestWindowService" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="TestWindowServiceShortcut" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ManufacturerFolder"
Name="!(bind.property.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="!(bind.property.ProductName)" />
</Directory>
</Directory>
<!-- Step 1: Define the directory structure -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder"
Name="TestWindowService"/>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the
ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<File Id="TestWindowService"
Source="$(var.TestWindowsService.TargetPath)" KeyPath="yes"/>
<ServiceInstall Id="TestWindowService"
DisplayName="TestWindowService" Name="TestWindowService" Description="Test
window service" Account="LocalSystem" ErrorControl="normal" Start="demand"
Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlWixService"
Name="TestWindowService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
</ComponentGroup>
<ComponentGroup Id="TestWindowServiceShortcut"
Directory="ApplicationProgramsFolder">
<Component Id="TestWindowServiceShortcut"
Guid="01E98283-4246-46BC-A39F-0F1975C95AA6">
<Shortcut Id="UninstallProduct" Name="Uninstall TestWindowService"
Description="Uninstalls TestWindowService Application"
Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]" Name="installed" Type="integer"
Value="1" KeyPath="yes"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I created shortcut for my windows service . When I uninstall the windows
service using shortcut then it removes service from startup menu, But I was
able to see the window service in services.msc tool (Note: it throws error
when I try to start\stop the particular win service ). If i uninstall it
from control panel's Add/Remove programes then it removes win service from
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestWindowService" Language="1033" Version="1.0.0.0"
Manufacturer="Test Service"
UpgradeCode="8cfc33c6-292f-4bad-a488-4781ae709c5e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is
already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="TestWindowService" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="TestWindowServiceShortcut" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ManufacturerFolder"
Name="!(bind.property.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="!(bind.property.ProductName)" />
</Directory>
</Directory>
<!-- Step 1: Define the directory structure -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder"
Name="TestWindowService"/>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the
ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<File Id="TestWindowService"
Source="$(var.TestWindowsService.TargetPath)" KeyPath="yes"/>
<ServiceInstall Id="TestWindowService"
DisplayName="TestWindowService" Name="TestWindowService" Description="Test
window service" Account="LocalSystem" ErrorControl="normal" Start="demand"
Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlWixService"
Name="TestWindowService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
</ComponentGroup>
<ComponentGroup Id="TestWindowServiceShortcut"
Directory="ApplicationProgramsFolder">
<Component Id="TestWindowServiceShortcut"
Guid="01E98283-4246-46BC-A39F-0F1975C95AA6">
<Shortcut Id="UninstallProduct" Name="Uninstall TestWindowService"
Description="Uninstalls TestWindowService Application"
Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]" Name="installed" Type="integer"
Value="1" KeyPath="yes"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>