C# Wix不会在卸载时删除服务和文件
首先,我读了这个主题:,但它没有帮助 我想用SQLite interop作为Windows服务安装我的应用程序。安装效果很好,但在卸载过程中,只有SQLite.Interop.dll文件被删除,服务仍在运行,文件被删除 我的WIX文件如下所示:C# Wix不会在卸载时删除服务和文件,c#,wix,C#,Wix,首先,我读了这个主题:,但它没有帮助 我想用SQLite interop作为Windows服务安装我的应用程序。安装效果很好,但在卸载过程中,只有SQLite.Interop.dll文件被删除,服务仍在运行,文件被删除 我的WIX文件如下所示: <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> &l
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" UpgradeCode="12345678-1234-1234-1234-111111111111" Name="MyApp Agent" Version="1.0.0" Manufacturer="MyApp" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="MyApp installer package" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<PropertyRef Id="NETFRAMEWORK40FULL" />
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK40FULL]]></Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyApp">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="SelfUpdate.exe" Source="!(bindpath.MainConsoleApp)\SelfUpdate.exe" />
<File Id="SQLite.Net.dll" Source="!(bindpath.MainConsoleApp)\SQLite.Net.dll" />
<File Id="SQLite.Net.Platform.Win32.dll" Source="!(bindpath.MainConsoleApp)\SQLite.Net.Platform.Win32.dll" />
<ServiceInstall Id="TrackCube" Type="ownProcess" Vital="yes" Name="TrackCube" DisplayName="TrackCube" Description="TrackCube" Start="auto" Account="LocalSystem" ErrorControl="ignore" Interactive="no">
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes"/>
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" ResetPeriodInDays="1" RestartServiceDelayInSeconds="20" />
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="TrackCube" Wait="yes" />
</Component>
<Directory Id="DIR_x86" Name="x86">
<Component Id="ApplicationFiles32" Guid="12345678-1234-1234-1234-222222222224">
<CreateFolder />
<File Id="SQLite.Interop.dll.86" Name="SQLite.Interop.dll" Source="!(bindpath.MainConsoleApp)\x86\SQLite.Interop.dll" />
</Component>
</Directory>
<Directory Id="DIR_x64" Name="x64">
<Component Id="ApplicationFiles64" Guid="12345678-1234-1234-1234-222222222228">
<CreateFolder />
<File Id="SQLite.Interop.dll.64" Name="SQLite.Interop.dll" Source="!(bindpath.MainConsoleApp)\x64\SQLite.Interop.dll" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="ARPSYSTEMCOMPONENT" Value="1" />
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles" />
<ComponentRef Id="ApplicationFiles32" />
<ComponentRef Id="ApplicationFiles64" />
</Feature>
[...]
Action 9:17:38: ProcessComponents. Updating component registration
Action start 9:17:38: ProcessComponents.
ProcessComponents:
Action ended 9:17:38: ProcessComponents. Return value 1.
MSI (s) (F8:58) [09:17:38:585]: Doing action: UnpublishFeatures
MSI (s) (F8:58) [09:17:38:585]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: UnpublishFeatures. Unpublishing Product Features
Action start 9:17:38: UnpublishFeatures.
UnpublishFeatures: Feature: Unpublishing Product Features
Action ended 9:17:38: UnpublishFeatures. Return value 1.
MSI (s) (F8:58) [09:17:38:586]: Doing action: StopServices
MSI (s) (F8:58) [09:17:38:586]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: StopServices. Stopping services
Action start 9:17:38: StopServices.
Action ended 9:17:38: StopServices. Return value 1.
MSI (s) (F8:58) [09:17:38:587]: Doing action: DeleteServices
MSI (s) (F8:58) [09:17:38:587]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: DeleteServices. Deleting services
Action start 9:17:38: DeleteServices.
Action ended 9:17:38: DeleteServices. Return value 1.
MSI (s) (F8:58) [09:17:38:588]: Doing action: RemoveFiles
MSI (s) (F8:58) [09:17:38:588]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: RemoveFiles. Removing files
Action start 9:17:38: RemoveFiles.
MSI (s) (F8:58) [09:17:38:589]: Note: 1: 2205 2: 3: RemoveFile
MSI (s) (F8:58) [09:17:38:589]: Note: 1: 2205 2: 3: RemoveFile
Action ended 9:17:38: RemoveFiles. Return value 0.
更新
多亏了鲍勃·阿森,我重新阅读了msi日志。我发现:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" UpgradeCode="12345678-1234-1234-1234-111111111111" Name="MyApp Agent" Version="1.0.0" Manufacturer="MyApp" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="MyApp installer package" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<PropertyRef Id="NETFRAMEWORK40FULL" />
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK40FULL]]></Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyApp">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="SelfUpdate.exe" Source="!(bindpath.MainConsoleApp)\SelfUpdate.exe" />
<File Id="SQLite.Net.dll" Source="!(bindpath.MainConsoleApp)\SQLite.Net.dll" />
<File Id="SQLite.Net.Platform.Win32.dll" Source="!(bindpath.MainConsoleApp)\SQLite.Net.Platform.Win32.dll" />
<ServiceInstall Id="TrackCube" Type="ownProcess" Vital="yes" Name="TrackCube" DisplayName="TrackCube" Description="TrackCube" Start="auto" Account="LocalSystem" ErrorControl="ignore" Interactive="no">
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes"/>
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" ResetPeriodInDays="1" RestartServiceDelayInSeconds="20" />
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="TrackCube" Wait="yes" />
</Component>
<Directory Id="DIR_x86" Name="x86">
<Component Id="ApplicationFiles32" Guid="12345678-1234-1234-1234-222222222224">
<CreateFolder />
<File Id="SQLite.Interop.dll.86" Name="SQLite.Interop.dll" Source="!(bindpath.MainConsoleApp)\x86\SQLite.Interop.dll" />
</Component>
</Directory>
<Directory Id="DIR_x64" Name="x64">
<Component Id="ApplicationFiles64" Guid="12345678-1234-1234-1234-222222222228">
<CreateFolder />
<File Id="SQLite.Interop.dll.64" Name="SQLite.Interop.dll" Source="!(bindpath.MainConsoleApp)\x64\SQLite.Interop.dll" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="ARPSYSTEMCOMPONENT" Value="1" />
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles" />
<ComponentRef Id="ApplicationFiles32" />
<ComponentRef Id="ApplicationFiles64" />
</Feature>
[...]
Action 9:17:38: ProcessComponents. Updating component registration
Action start 9:17:38: ProcessComponents.
ProcessComponents:
Action ended 9:17:38: ProcessComponents. Return value 1.
MSI (s) (F8:58) [09:17:38:585]: Doing action: UnpublishFeatures
MSI (s) (F8:58) [09:17:38:585]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: UnpublishFeatures. Unpublishing Product Features
Action start 9:17:38: UnpublishFeatures.
UnpublishFeatures: Feature: Unpublishing Product Features
Action ended 9:17:38: UnpublishFeatures. Return value 1.
MSI (s) (F8:58) [09:17:38:586]: Doing action: StopServices
MSI (s) (F8:58) [09:17:38:586]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: StopServices. Stopping services
Action start 9:17:38: StopServices.
Action ended 9:17:38: StopServices. Return value 1.
MSI (s) (F8:58) [09:17:38:587]: Doing action: DeleteServices
MSI (s) (F8:58) [09:17:38:587]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: DeleteServices. Deleting services
Action start 9:17:38: DeleteServices.
Action ended 9:17:38: DeleteServices. Return value 1.
MSI (s) (F8:58) [09:17:38:588]: Doing action: RemoveFiles
MSI (s) (F8:58) [09:17:38:588]: Note: 1: 2205 2: 3: ActionText
Action 9:17:38: RemoveFiles. Removing files
Action start 9:17:38: RemoveFiles.
MSI (s) (F8:58) [09:17:38:589]: Note: 1: 2205 2: 3: RemoveFile
MSI (s) (F8:58) [09:17:38:589]: Note: 1: 2205 2: 3: RemoveFile
Action ended 9:17:38: RemoveFiles. Return value 0.
MSI(c)(A4:C8)[09:17:36:719]:不允许卸载组件:{12345678-1234-1234-1234-2222},因为存在另一个客户端
稍后查看日志。您引用的部分只是MSI处理数据库的部分,而不是它实际尝试停止和删除服务的部分。@我添加了另一个日志部分,但仍然不知道为什么它不工作。请使用中描述的MSINV工具查看安装了哪些其他产品导致MSI阻止卸载。