alr*_*tyy 5 c# windows windows-installer windows-services wix
错误:使用WiX工具集为Windows服务创建新的安装程序.无法安装该服务.获取错误
错误截图
我想创建一个安装Windows服务的MSI.
Windows服务已在services.msc中安装并可见
停止并删除该服务.
我的Windows服务有很多依赖项,在运行服务时使用.
我已将所有文件添加ServiceDependency为组件并为每个组件ID 添加,但仍无法解决错误.事件查看器中的错误也与上面的屏幕截图相同.
任何指针都是最受欢迎的.
<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>
Run Code Online (Sandbox Code Playgroud)
删除服务依赖项后更新了源代码,但仍然收到相同的错误.
删除了空格,但仍然得到相同的错误.
附加了详细日志.请从以下链接下载.
http://www.yourfilelink.com/get.php?fid=1432133
你能试试这段wix代码吗?我稍微清理了一下以删除一些默认值。
除非您想使用不同的文件名放置文件,否则您不需要 Name 属性。
如果您希望您的服务作为本地系统运行,那么您需要设置空帐户。如果您希望它以特定用户身份运行,那么您可以在命令行上设置属性 SVCACCOUNT=someuser SVCPASSWORD="password",否则只需跳过它们。
如果 Name 和 Id 相同,那么您可以跳过 Id。
我更喜欢为我在多个地方使用的东西使用变量以避免拼写错误,例如我使用的 ServiceInstall 和 ServiceControl 中使用的 ServiceName:
<WixVariable Id="ServiceName" Value="LayoutSwitcher" />
<Component Id="PlcmLayoutSwitcherWinSvc.exe" Guid="PUT_GUID_HERE">
<File Id="LayoutSwitcherWinSvc.exe" Source="$(var.LayoutSwitcherWinSvc_TargetDir)LayoutSwitcherWinSvc.exe" KeyPath="yes" />
<ServiceInstall Name="!(wix.ServiceName)"
DisplayName="LayoutSwitcher"
Description="LayoutSwitcher"
ErrorControl="ignore"
Type="ownProcess"
Vital="yes"
Start="auto"
Account="[SVCACCOUNT]"
Password="[SVCPASSWORD]"
Interactive="no" />
<ServiceControl Id="ServiceControl_!(wix.ServiceName)"
Name="!(wix.ServiceName)"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
Run Code Online (Sandbox Code Playgroud)
您附加的日志不完整,请一直运行安装程序并仅在您关闭安装程序后附加日志。不需要 IMO 调试日志。