我正在将一组安装程序从 VS2010 移动到 WIX,并且在我们的 NT 服务应用程序中遇到了错误。
使用 WIX 安装程序创建和安装 NT 服务后,该服务不会查找您所期望的命名的 app.config (ApplicationName.exe.config)。我们的应用程序名称类似于 XXX.YYYYYYYY,并且在启动期间将调试器注入服务时,我可以看到它正在寻找 XXX.config 而不是 XXX.YYYYYYY.exe.config。
我尝试通过控制台运行应用程序,当我这样做时,它会查找正确的 app.config 文件名。使用 VS2010 安装程序还可以让服务查找正确的 app.config 文件名。
wxi3.8 中是否有一些我遗漏的设置,或者输入了不正确的值,这会导致这种情况?这是控制服务的 wxs 段:
<Component Id="Service" Guid="DCE18608-D25F-4DC0-9E1B-C2E3575D0BFE">
<File Id="ServiceComponentMain" Name="$(var.XXX.YYYYYYY.TargetName)" Source="$(var.HHG.SpecOrderLoadSync.TargetPath)"
DiskId="1" Vital="yes" KeyPath="yes"/>
<ServiceInstall Id="Service" Name="$(var.XXX.YYYYYYY.TargetName)" Type="ownProcess" DisplayName="$(var.XXX.YYYYYYY.TargetName)"
Description="$(var.XXX.YYYYYYY.TargetName)" Start="auto" Account="NT AUTHORITY\LocalService" ErrorControl="normal">
<util:PermissionEx User="Everyone" ServicePauseContinue="yes" ServiceQueryStatus="yes"
ServiceStart="no" ServiceStop="yes" ServiceUserDefinedControl="yes"/>
</ServiceInstall>
<ServiceControl Id="Service" Stop="both" Remove="both" Name="$(var.XXX.YYYYYYY.TargetName)" Wait="no"/>