1

我有一个 Windows 服务项目,其中包含一个 WCF(selfhost)服务(几个 dll 文件和一个 app.config),这是用 Wix 安装的。

我添加了对我的 Wix 安装包的引用,这是 Product.wxs 文件的样子:

<?xml version="1.0" encoding="UTF-8"?>

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="MyAppINSTALLDIR" Name="MyApp 5Service">
        <Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
          <File Id="MyApp.WindowsService.exe" Name="MyApp.WindowsService.exe" Source="$(var.MyApp .WindowsService.TargetDir)\MyApp.WindowsService.exe"/>
          <ServiceInstall Id="InstallMyAppService" DisplayName="MyAppService" Name="MyApp .WindowsService.exe" Description="MyApp 5 Service - För effektivare och enklare operationsplanering" Account="NetworkService" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
          <ServiceControl Id="ControlMyAppService" Name="MyApp5.WindowsService.exe" Stop="uninstall" Remove="uninstall" />
        </Component>
    </Directory>
</Directory>

<Property Id="WIXUI_INSTALLDIR" Value="MyAppINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />

<Feature Id="ProductFeature" Title="Wix_MyApp.WindowsService" Level="1">
  <ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>

这项工作达到了一定程度,现在我有一些问题:

  1. 现在它只包括我的主要 Windows 服务 exe 文件?我需要它来包含我的 Selfhost 的所有输出
  2. 我需要能够在安装之前设置 Windows 服务项目的 app.config(它决定已安装服务的名称),是否可以在运行安装程序之前不使用压缩和设置文件,或者在安装过程中更容易获取信息安装并将其设置为 app.config?

编辑1:

要从输出中获取所有文件,我更改为这个,但它不起作用?:

      <File Id="MyApp.WindowsService.Output"
        Name="$(var.MyApp.WindowsService.TargetFileName)"
        Source="$(var.MyApp.WindowsService.TargetPath)"
        KeyPath="yes" />

      <ServiceInstall Id="InstallMyAppService" DisplayName="MyAppService" Name="MyApp.WindowsService.exe" Description="MyApp 5 Service - För effektivare och enklare operationsplanering" Account="NetworkService" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
      <ServiceControl Id="ControlMyAppService" Name="MyApp.WindowsService.exe" Stop="uninstall" Remove="uninstall" />


    </Component>
4

1 回答 1

1
  1. 要将另一个文件添加到您的安装程序,只需向您的安装程序添加一个新文件<Component>并将其<File>放入其中。您还需要<ComponentRef>将该组件放入<Feature>.
  2. 您可以在安装过程中使用<XmlConfig><XmlFile>元素来修改您的 app.config。
于 2012-12-19T12:45:56.393 回答