0

我正在将一组安装程序从 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"/>

4

1 回答 1

0

在翻遍注册表后终于想通了。看来,对于我当前的 wsx 文件,它没有注册到可执行文件的完整路径,包括最后的“.exe”。这就是导致配置文件名混淆的原因。为什么在世界上这会有所作为,这超出了我的理解,但我想这只是另一件事让我对窗户感到恼火......

要解决此问题,将上述段中 File 元素上的 Name 更改为 $(var.XXX.YYYYYYY.TargetName).exe 而不是 $(var.XXX.YYYYYYY.TargetName) 似乎可行。

于 2014-05-07T13:22:28.660 回答