Unresolved reference to symbol in Wix
Asked Answered
M

1

8

I am trying to create a installer for MVC4 application using Wix. I found an example that shows how to create an installer for a MVC4 Application at this link

But when I try to build the Wix Setup Project, it gives me errors like below

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`

I tried adding WixUIExtension as a reference but it doesn't work.

This is the Product.wxs. And feature node's children nodes causes this error

    <?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>

What am I doing wrong? I know its very specific for SO but I cannot find any solution on the web.

I am using VS 2012- Wix 4.0

Magnetograph answered 7/5, 2014 at 21:21 Comment(0)
C
6

The error message says it all: it expects a ComponentGroup-tag containing your components (containing e.g. files or registry keys). If you take a look at the example project that you linked in your question, the <ComponentGroupRef Id="DemoWebsiteIssConfiguration" />-element references a ComponentGroup with the name DemoWebsiteIssConfiguration. You can find this in the file DemoWebsite.Setup\IISConfiguration.wxs:

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

It is a ComponentGroup which contains two components or, in this case, references to two components. These components are defined above the ComponentGroup-element in the same file.

Regarding the other ComponentGroupRef with the id MyWebComponents: The referenced ComponentGroup is created dynamically during the build. You can take a look at the file DemoWebsite.Setup\setup.build. This file is a MSBuild-file used to build the setup. It contains a target named Harvest that invokes heat, another tool in the WiX Toolset package. heat will parse e.g. a directory and gather all the files contained within and put them in a ComponentGroup that you can reference in your source file. I.e. you define a reference to a ComponentGroup and then you can create the content of this dynamically. This way you don't have to bother if a file is added to or removed from the project, as heat will gather them dynamically.

 <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>

The name of the dynamically created ComponentGroup is defined with the parameter -cg. you can invoke heat with the parameter -? for a short description of the possible parameters.

Counterscarp answered 8/5, 2014 at 7:43 Comment(2)
+1 informative answer. I found the IISConfiguration.wxs and put it to the Wix project then one problem is gone. And only one is left and related with <ComponentGroupRef Id="MyWebWebComponents" />. Where should I get the MyWebWebComponents ? The setup.build already in there doesnt help the wix project to be build. Should I manually generate it by using heat ? (Note: I am using Wix 4.0 now)Eigenfunction
Downloading the whole project, creating a publish-folder in DemoWebsite.Setup, putting some files in it and then invoking msbuild setup.build will build an MSI, harvesting all the files in the created DemoWebsite.Setup\publish-folder. However you could also create a source file with the related ComponentGroup manually by yourself or use heat to harvest a directory with the needed files. heat will create another WiX source file that you have to reference on invoking candle and light, so the referenced ComponentGroup is found. Use the Exec-taks in setup.build as examples.Counterscarp

© 2022 - 2024 — McMap. All rights reserved.