首页 > 解决方案 > 无文件的 WIX 组件

问题描述

我是 WIX 的新手,并试图将 msi 作为现有(BIG)Wix 安装项目的一部分安装,该项目已经安装了几个应用程序。所以我在 Bootstrapper 包中添加包,就像另一个 msi 的现有包一样。

<Fragment>
        <Variable Name="MyCoditionVariable" Type="numeric" Value="0"/> <!--This variable is being set by selected feature in UI-->
        <PackageGroup Id="MyMSIConnector">
          <MsiPackage Id="MyMSIConnectorSetup"
              DisplayName="My MSI"
              Cache="no"
              Compressed="yes"
              ForcePerMachine="yes"
              Permanent="no"
              Vital="yes"
              SourceFile="$(var.RedistDir)\Connector.msi"
              InstallCondition="MyCoditionVariable">
          </MsiPackage>
        </PackageGroup>
    </Fragment>

它成功安装在默认的 Porgram Files (86) 文件夹中。此 msi 还安装默认启动的 Window Service。现在我的要求是 - 安装后我想停止这个窗口服务。- 并且还添加了此 msi 安装与否的注册表值。

所以我当然需要一个组件,但我不确定,如何在没有这个 msi/文件关系的情况下创建一个组件。如果我尝试

<Fragment>
    <DirectoryRef Id="ProgramFilesFolder">
      <Component Id="MyMSICompnonentId" Guid="{3F29E17B-F4E3-4656-BA97-7ACE9D202FA5}">
        <ServiceControl Id="MyMSIControl" Name="Control.CommunicationManager" Stop="both" Remove="uninstall" Wait="yes"/>
      </Component>
    </DirectoryRef>
  </Fragment>

然后在 Product.wxs

<Feature Id="ProductFeature" Title="StopCognyticService" Level="1">
        <ComponentRef Id="MyMSICompnonentId" />
    </Feature>

项目没有构建,因为没有 KeyFile 或位置。如果我使用组件设置'KeyPath =“yes”'然后项目构建但它在安装过程中完全忽略(可能需要与用户机器上的物理文件关联???)

MSI (s) (84:28) [02:03:16:324]: Component: MyMSICompnonentId; Installed: Absent;   Request: Null;   Action: Null

请对此有任何提示。

标签: c#wix

解决方案


虽然您可以向组件添加一个 CreateFolder 元素,但这个 ServiceControl 元素真的需要它自己的组件吗?您可以将其作为资源添加到另一个组件,例如更新注册表值的组件。


推荐阅读