开发者

windows service not removed while uninstalling setup created in WIX

开发者 https://www.devze.com 2023-04-02 14:03 出处:网络
I have created the se开发者_如何学Gotup which installs windows service, but when i uninstall it the service remains started and not removes. I have createwd the setup msi in Wix.

I have created the se开发者_如何学Gotup which installs windows service, but when i uninstall it the service remains started and not removes. I have createwd the setup msi in Wix.

 <DirectoryRef Id="INSTALLDIR">
       <Component Id='MyComponent' Guid='CDBA9BC4-F839-4CAB-8AB0-4397EC079541'>
<File Id='LogFWService' Name='LogFWService.exe' Source="$(var.LFShared)\LogFWService.exe" KeyPath="yes" />
 <ServiceInstall Id="InstallLFService" Name="LogFWService" DisplayName="OpenFramework Logging Service" Start="auto" ErrorControl="normal" Description="Captures log events and inserts the log messages into database" Type="ownProcess">
           <ServiceDependency Id="MSMQ" />
 </ServiceInstall>

<ServiceControl Id="sc_InstallLFService" Name="LogFWService" Start="install" Remove="uninstall" Stop="both" Wait="yes"/>
       </Component>
     </DirectoryRef>

Even i have used the remove file attribute but it stills doesnot removes the windows service while uninstalling. Please help is any one have any knowledge about uninstalling windows service.


I had a similar problem. I'm not 100% sure but I think it disappeared after I changed the GUID of the installation component. Previous GUID was copy pasted from another project along with the whole installation markup for installing windows service and I forgot to replace it with new GUID.

BTW You can delete the "leftover" service using command propmt command sc:

sc delete "YourServiceNameHere"


I have had this happen when testing multiple versions of the same wix installer in a development environment. The problem is that it cannot remove an entity (component) because there is a dependency that is still declared. Its usually due to some registry keys being left over from prior attempts.

Searching for the following and deleting the appropriate (not all) keys

  • The ID of the key file in a component
  • The GUID of the component
  • The directory/folder name (can be included reference counts in \HKLM\MS\Win\CurVer\Installer\Folders)
  • The name of the key file (also reference counts, but not in the Folders key)

Some keys that show up for the name searches tended to be in Most Recently Used lists, or other benign locations. This can be a tedious process when using the standard regedit, so a better tool is recommended if you go this route.

Ideally, you should be testing installers on a machine that can be reverted to a prior state.

0

精彩评论

暂无评论...
验证码 换一张
取 消