我使用WIX开发了一个msi设置,它由桌面应用程序和Windows服务组成,两者都在C#.Net 3.5框架上运行。只有当任何用户登录到触发桌面应用程序启动的系统时,我的Windows服务才会启动。 Windows服务使其作为本地系统运行。 msi设置已在Win-8,Win-7和Windows-XP上成功安装,但在卸载时显示“正在使用文件”消息,即使服务未从SCM中删除。我已经给出以下代码分别位于服务的OnStop()方法和WIX页面内。
onStop()方法:
Process[] workers = Process.GetProcessesByName("filename");
workers[0].WaitForExit(1000);
workers[0].Kill();
workers[0].Dispose();
workers[0].Close();
WIX中的Product.wxs:
<ServiceInstall Id="ServiceInstaller" Name="Servicename"
DisplayName="service display name" Description="service description"
Start="auto" Account="LocalSystem" ErrorControl="normal"
Type="ownProcess"></ServiceInstall>
<ServiceControl Id="ServiceInstallerControl" Name="Servicename"
Start="install" Stop="both" Remove="uninstall" Wait="yes" />
根本不会从SCM中删除该服务,并且在卸载过程中会显示以下弹出消息。
我已经使用WIX来解决问题,但无法解决问题。
在这方面的任何形式的帮助都将受到高度赞赏。
答案 0 :(得分:0)
我建议您创建处理卸载的自定义操作。您可以使用卸载详细信息创建批处理文件,然后只需从自定义操作执行批处理文件(作为一个过程)。这是一个好的做法使用您的服务创建安装和卸载批处理文件。