2017-01-09 83 views
0

我試圖讓Wix在卸載時刪除Windows服務。它在安裝過程中很好地添加了該服務,但在卸載過程中,而不是刪除該服務,只是將其禁用。此外,我無法使用命令行sc工具刪除它,因爲它表示指定的服務不作爲已安裝的服務存在。如果我嘗試再次運行安裝程序,它會告訴我我沒有足夠的權限來安裝系統服務。我可以擺脫它的唯一方法是從註冊表中刪除它並重新啓動機器。必須有更好的方法來做到這一點。這是我從WXS文件組件塊:如何讓WiX刪除Windows服務?

<Component Id="MyService.exe" Guid="5187d4cf-c7b7-4f9e-9f2c-2d0557ecdf5e"> 
    <File Id="MyService.exe" Name="MyService.exe" DiskId="1" Source="$(var.MyService.TargetDir)\MyService.exe" KeyPath="yes" /> 
    <ServiceInstall Id="MyService.exe" Type="ownProcess" Name="MyService.exe" DisplayName="MyService" Description="MyService" 
        Start="auto" Account="LocalSystem" ErrorControl="normal" Vital="yes" /> 
    <ServiceControl Id="MyService.exe" Stop="both" Remove="uninstall" Name="MyService.exe" Wait="yes" /> 
    </Component> 

有我丟失的東西嗎?

回答

1

事實證明,該服務未被刪除的原因是因爲我打開了服務MMC。一旦我關閉並重新打開它,服務就會成功刪除。

+0

良好的舊'標記爲刪除',但實際上不會被刪除,直到您關閉此窗口問題。 –