繁体   English   中英

Wix中未解析的符号引用

[英]Unresolved reference to symbol in Wix

我正在尝试使用Wix为MVC4应用程序创建一个安装程序。 我找到了一个示例,演示了如何在此链接上为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

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

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

它是一个ComponentGroup ,它包含两个组件,或者在本例中是对两个组件的引用。 这些组件在同一文件中的ComponentGroup -element上方定义。

关于具有id MyWebComponents的其他ComponentGroupRef :引用的ComponentGroup是在构建期间动态创建的。 您可以查看DemoWebsite.Setup\\setup.build文件。 此文件是用于构建设置的MSBuild文件。 它包含一个名为Harvest的目标,它可以调用heat ,这是WiX Toolset包中的另一个工具。 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>

使用参数-cg定义动态创建的ComponentGroup的名称。 你可以用参数调用heat -? 有关可能参数的简短描述。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM