【发布时间】:2018-04-13 16:21:53
【问题描述】:
错误:使用 WiX 工具集为 Windows 服务创建新安装程序。无法安装服务。收到错误
Error screenshot
环境
- 微软视觉工作室 2017
- Windows 7
- WiX 工具集 v3:MSI 设置项目
问题/目标
我想创建一个安装 Windows 服务的 MSI。
安装时:
Windows 服务已安装并在 services.msc 中可见
卸载时:
停止并删除服务。
我的 Windows 服务有很多依赖项,在运行服务时要使用这些依赖项。
我已将所有文件添加为组件,并为每个组件 ID 添加了ServiceDependency,但仍然无法解决错误。事件查看器中的错误也与上面的屏幕截图相同。
欢迎任何指点。
我的代码
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="LayoutSwitcher" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="LayoutSwitcher" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="PlcmLayoutSwitcherWinSvc.exe" Guid="PUT_GUID_HERE" KeyPath="yes">
<File Id="LayoutSwitcherWinSvc.exe"
Name="LayoutSwitcherWinSvc.exe" Source="$(var.LayoutSwitcherWinSvc_TargetDir)LayoutSwitcherWinSvc.exe" />
<CreateFolder />
<ServiceInstall Id="LayoutSwitcher" Type="ownProcess" Vital="yes"
Name="LayoutSwitcher" DisplayName="LayoutSwitcher"
Description="LayoutSwitcher" Start="auto" Account="NT AUTHORITY\LocalSystem"
ErrorControl="ignore" Interactive="no">
<ServiceControl Id="StartService" Start="install" Stop="both"
Remove="uninstall" Name="LayoutSwitcher" Wait="yes" />
</Component>
<Component Id="logoicon.ico" Guid="PUT_GUID_HERE">
<File Id="logoicon.ico" Name="logoicon.ico" Source="$(var.LayoutSwitcherWinSvc_ProjectDir)logoicon.ico" />
</Component>
<Component Id="LayoutSwitcherWinSvc.exe.config" Guid="PUT_GUID_HERE">
<File Id="LayoutSwitcherWinSvc.exe.config" Name="LayoutSwitcherWinSvc.exe.config" Source="$(var.LayoutSwitcherWinSvc_TargetDir)LayoutSwitcherWinSvc.exe.config" />
</Component>
<Component Id="Transactions.dll" Guid="PUT_GUID_HERE">
<File Id="Transactions.dll" Name="Transactions.dll" Source="$(var.LayoutSwitcherWinSvc_TargetDir)Transactions.dll" />
</Component>
<Component Id="Transactions.Cfg.dll" Guid="PUT_GUID_HERE">
<File Id=" Transactions.Cfg.dll" Name="Transactions.Cfg.dll" Source="$(var.LayoutSwitcherWinSvc_TargetDir) Transactions.Cfg.dll" />
</Component>
编辑:1
去掉服务依赖后更新了源码,还是报同样的错误
编辑:2
删除了空格,但仍然出现相同的错误。
编辑:3
附上详细日志。请从以下链接下载。
http://www.yourfilelink.com/get.php?fid=1432133
【问题讨论】:
-
查看事件查看器,查看缺少哪个文件。当实际上由于缺少组件而无法安装服务时,Wix 服务安装程序会弹出“拒绝访问”等错误。肯定抓到我很多次了!几乎可以保证您缺少项目 dll 或依赖框架,如 c++ redist 或 .net 框架
标签: c# windows wix windows-services windows-installer