【问题标题】:Unresolved reference to symbol in Wix未解决的对 Wix 中符号的引用
【发布时间】:2014-05-07 21:21:49
【问题描述】:

我正在尝试使用 Wix 为 MVC4 应用程序创建安装程序。我在this link找到了一个示例,展示了如何为 MVC4 应用程序创建安装程序

但是当我尝试构建 Wix 设置项目时,它给了我如下错误

Error   16  Unresolved reference to symbol 'WixComponentGroup:MyWebWebComponents' 
in section 'Product:{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}'.    
C:\Users\Baris\Desktop\New folder\WIXInstallerDemo-master\DemoWebsite.Setup\Product.wxs 15  
1   DemoWebsite.Setup

Error   17  Unresolved reference to symbol 'WixComponentGroup:DemoWebsiteIssConfiguration' 
in section 'Product:{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}'.    
C:\Users\Baris\Desktop\New folder\WIXInstallerDemo-master\DemoWebsite.Setup\Product.wxs 16  
1   DemoWebsite.Setup`

我尝试添加 WixUIExtension 作为参考,但它不起作用。

这是 Product.wxs。并且特征节点的子节点会导致此错误

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}" Name="Demo website setup" Language="1033" Version="1.0.0.0" Manufacturer="Me" UpgradeCode="9279b740-8419-45c4-9538-6a45f8e949c7">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="DemoWebsite.cab" EmbedCab="yes" />

    <Property Id="DB_USER" Value="sa"/>
    <Property Id="DB_PASSWORD" Value="sa"/>
    <Property Id="DB_SERVER" Value="LOCAL"/>
    <Property Id="DB_DATABASE" Value="DemoWebsite"/>

    <Feature Id="ProductFeature" Title="DemoWebsite.Setup" Level="1">
      <ComponentGroupRef Id="MyWebWebComponents" />
      <ComponentGroupRef Id="DemoWebsiteIssConfiguration" />
    </Feature>
    <!-- Specify UI -->
    <UIRef Id="MyUI" />
    <Property Id="WIXUI_INSTALLDIR" Value="INETPUB" />
  </Product>

  <Fragment>
    <!-- Will default to C:\ if that is the main disk-->
    <Directory Id="TARGETDIR" Name="SourceDir">
      <!-- Will reference to C:\inetpub-->
      <Directory Id="INETPUB" Name="Inetpub">
        <!-- Will reference to c:\Inetpub\Demowebsite-->
        <Directory Id="INSTALLFOLDER" Name="DemoWebsite">
        </Directory>
      </Directory>
    </Directory>
  </Fragment>
</Wix>

我做错了什么?我知道它非常适用于 SO,但我在网上找不到任何解决方案。

我正在使用 VS 2012-Wix 4.0

【问题讨论】:

    标签: c# .net asp.net-mvc-4 wix wix-extension


    【解决方案1】:

    错误消息说明了一切:它需要一个包含您的组件(例如文件或注册表项)的ComponentGroup-tag。如果您查看您在问题中链接的示例项目,&lt;ComponentGroupRef Id="DemoWebsiteIssConfiguration" /&gt;-元素引用了名称为 DemoWebsiteIssConfigurationComponentGroup。你可以在文件DemoWebsite.Setup\IISConfiguration.wxs中找到这个:

    <ComponentGroup Id="DemoWebsiteIssConfiguration">
      <ComponentRef Id="InstallWebsite" />
      <ComponentRef Id="DemoWebsiteAppPool" />
    </ComponentGroup>
    

    它是一个ComponentGroup,它包含两个组件,或者在这种情况下,引用两个组件。这些组件在同一文件中的ComponentGroup-元素上方定义。

    关于 ID 为 MyWebComponents 的另一个 ComponentGroupRef:引用的 ComponentGroup 在构建期间动态创建。您可以查看文件DemoWebsite.Setup\setup.build。此文件是用于构建设置的MSBuild 文件。它包含一个名为Harvest 的目标,该目标调用heat,这是WiX 工具包中的另一个工具。 heat 将解析例如一个目录并收集其中包含的所有文件并将它们放在您可以在源文件中引用的ComponentGroup 中。 IE。您定义一个对 ComponentGroup 的引用,然后您可以动态地创建它的 content。这样,您就不必为项目添加或删除文件而烦恼,因为heat 会动态收集它们。

     <Target Name="Harvest">
        <!-- Harvest all content of published result -->
        <Exec
            Command='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
            ContinueOnError="false"
            WorkingDirectory="." />
      </Target>
    

    动态创建的ComponentGroup 的名称由参数-cg 定义。您可以使用参数-? 调用heat,以获得可能参数的简短描述。

    【讨论】:

    • +1 信息丰富的答案。我找到了 IISConfiguration.wxs 并将其放入 Wix 项目,然后一个问题就消失了。并且只剩下一个与 相关。我应该在哪里获得 MyWebWebComponents ?已经存在的 setup.build 无助于构建 wix 项目。我应该使用 heat 手动生成它吗? (注:我现在使用的是 Wix 4.0)
    • 下载整个项目,在DemoWebsite.Setup中创建一个publish-文件夹,将一些文件放入其中,然后调用msbuild setup.build将构建一个MSI,收集创建的@987654348中的所有文件@-文件夹。但是,您也可以自己手动创建具有相关ComponentGroup 的源文件,或使用heat 来获取包含所需文件的目录。 heat 将创建另一个您在调用 candlelight 时必须引用的 WiX 源文件,因此找到了引用的 ComponentGroup。以setup.build 中的Exec-taks 为例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多