Wix中未解析的符号引用

时间:2014-05-07 21:21:50

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

我正在尝试使用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>

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

我正在使用VS 2012- Wix 4.0

1 个答案:

答案 0 :(得分:6)

错误消息说明了一切:它需要一个ComponentGroup - 包含您的组件的标记(包含例如文件或注册表项)。如果您查看在问题中链接的示例项目,<ComponentGroupRef Id="DemoWebsiteIssConfiguration" /> - 元素会引用名为ComponentGroup的{​​{1}}。您可以在文件DemoWebsiteIssConfiguration中找到它:

DemoWebsite.Setup\IISConfiguration.wxs

它是<ComponentGroup Id="DemoWebsiteIssConfiguration"> <ComponentRef Id="InstallWebsite" /> <ComponentRef Id="DemoWebsiteAppPool" /> </ComponentGroup> ,包含两个组件,或者在这种情况下,包含两个组件的引用。这些组件在同一文件中的ComponentGroup - 元素之上定义。

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

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以获取可能参数的简短描述。

相关问题