【问题标题】:C# Wix Service installer - Unresolved reference to symbolC# Wix 服务安装程序 - 未解决的符号引用
【发布时间】:2018-08-07 20:04:46
【问题描述】:

我使用 Viwual Studio 2017 在 C# 中创建了一个服务。

现在我正在尝试使用 Wix 创建安装程序。这不是我第一次使用 wix,但这次我无法构建我的设置。我有错误:

未解决对符号“组件:安装组件”的引用 “产品:*”部分。

我看到了一些关于这个的话题,但它并没有解决我的问题。

这是我的 product.wxs :

<?xml version="1.0" encoding="UTF-8"?>
<?define compagny = "myCompagny"?>
<?define product = "Service Name"?>
<?define service = "MyService"?>
<?define version = "!(bind.FileVersion.MyService.exe)"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" 
           Name="$(var.product)"
           Language="1033"
           Version="$(var.version)"
           Manufacturer="$(var.compagny)" 
           UpgradeCode="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <Media Id="1" Cabinet="MyService.cab" EmbedCab="yes" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
        <Directory Id="CGYFOLDER" Name="$(var.compagny)">
          <Directory Id="INSTALLFOLDER" Name="$(var.product)" />
        </Directory>
            </Directory>
        </Directory>

    <ComponentGroup Id="InstallComponents">
      <Component Id="InstallService" Guid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" Directory="INSTALLFOLDER">
        <File Id="MyService.exe.config"
              Name="$(var.service).exe.config"
              Source="$(var.MyService.TargetDir)\$(var.service).exe.config"
              Vital="yes"/>
        <RemoveFile Id="ALLFILES" Name="*.*" On="both" />
        <ServiceInstall Id="ServiceInstaller"
                        Type="ownProcess"
                        Vital="yes"
                        Name="$(var.service)"
                        DisplayName="$(var.product)"
                        Description=""
                        Start="auto"
                        Account="LocalSystem"
                        ErrorControl="normal" />
        <ServiceControl Id="Service_Start" Name="MyService" Start="install" Wait="no" />
        <ServiceControl Id="Service_Stop" Name="MyService"  Stop="both" Remove="uninstall" Wait="yes" />
      </Component>
    </ComponentGroup>

    <!-- Tell WiX to install the files -->
    <Feature Id="ProductFeature" Title="$(var.product)" Level="1">
      <ComponentRef Id="InstallComponents" />
    </Feature>
    </Product>
</Wix>

ComponentGroup 中存在InstallComponents,我不明白为什么会出现这个错误。

【问题讨论】:

  • 黑暗中的镜头:必须是&lt;ComponentRef Id="InstallComponents.InstallService" /&gt;&lt;ComponentRef Id="InstallService" /&gt;
  • @reporter 它适用于&lt;ComponentGroupRef Id="InstallComponents" /&gt;,谢谢
  • 然后将您的评论转换为答案,然后将其标记为已接受。

标签: c# wix


【解决方案1】:

错误出现在我的功能中。

我的InstallComponents 被定义为ComponentGroup,所以要安装它,我的功能必须是这样的:

<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
  <ComponentGroupRef Id="InstallComponents" />
</Feature>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-05
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    相关资源
    最近更新 更多