Add Heat to Wix Project

There are two really powerful ways to harvest the output from the build in to Wix.

Heat extensions that are native with the Wix Install or John Robbins Paraffin. The advantage with using Heat is that with some clients there is a lot of controls with utilising software from the interweb, and Heat is available from the same location as Wix.

The Wix installation is available from here, remember that you will need v3.5 to use with Visual Studio 2010. (Yes it is still listed as Beta, however it works very well!)

Once you have installed Wix and and the project aggregator, the steps to use Heat to harvest the project output are as follows:

 

Step

Description

  1.  

Create new Wix Project in the solution that you need to build

  1.  

Add the references to the projects that you want packaged

  1.  

Create a new wxs file called “<myPackage>.wxs”

  1.  

Right Click on yourWix Project and select “Unload Project”

  1.  

IN VS2008, at the prompt, click on continue

clip_image002

  1.  

Right click on your Wix project and select “Edit yourWixProject.wixproj”

  1.  

Ensure that all your project references are included in the project xml

  1.  

Scroll to the end of the file

  1.  

Add the following snippet

  <!– Add the Heat–>

  <ItemGroup>

    <HeatProject Include=@(ProjectReference->’%(FullPath)’)>

      <ProjectOutputGroups>Binaries;Symbols;Documents;Satellites;Content</ProjectOutputGroups>

    </HeatProject>

  </ItemGroup>

  1.  

Save your project

  1.  

Right click on your project in solution explorer and select “Reload Project”

  1.  

If you still have the project open in the editor, you will be prompted to close it. Click yes and continue

  1.  

At this point, your wix project is now heat enabled, but not wired up

  1.  

Edit the “<myPackage>.wxs” file

  1.  

In the Fragment add a reference for each binaries directory that you want included

<DirectoryRef Id=AppRootDir>

    <Directory Id=ComponentDir ComponentGuidGenerationSeed=Insert New GUID Here>

            <Directory Id=MyReferencedProject.Binaries />

      </Directory>

</DirectoryRef>

  1.  

In the Fragment add a reference for each Symbols directory that you want included

<DirectoryRef Id=AppSymbolDir”>

    <Directory Id=ComponentDir ComponentGuidGenerationSeed=Insert New GUID Here>

            <Directory Id=MyReferencedProject.Symbols />

      </Directory>

</DirectoryRef>

  1.  

For the other Project Outputs (Documents;Satellites;Content), the principal is the same, the DirectoryRef is the “appRootDir”

  1.  

For each item that is to be included in the package, a component Group and Component Group Ref needs to be added at the bottom of the file

  <ComponentGroup Id=Project>

      <ComponentGroupRef Id=MyReferencedProject.Binaries />

      <ComponentGroupRef Id=MyReferencedProject.Symbols />

  </ComponentGroup>

  1.  

Run the full solution build, and an MSI should appear

  1.  

Use Insted or Orca to check that the correct components are included in the MSI

 

So the project.wxs looks like

<?xml version=”1.0″ encoding=”UTF-8″?>
<Wix xmlns=”http://schemas.microsoft.com/wix/2006/wi”>
  <Product Id=”*” Name=”SetupDemo” Language=”1033″ Version=”1.0.0.0″ Manufacturer=”SetupDemo” UpgradeCode=”78282ed7-9280-497b-affa-da3fce3f4f47″>
    <Package InstallerVersion=”200″ Compressed=”yes” Id =”*” />

    <Media Id=”1″ Cabinet=”Demo1.cab” EmbedCab=”yes” />

    <Directory Id=”TARGETDIR” Name=”SourceDir”>
      <Directory Id=”ProgramFilesFolder”>
        <Directory Id=”INSTALLLOCATION” Name=”SetupDemo”>
          <Directory Id=”AppRootDir” Name=”Demo”/>
          <Directory Id=”AppSymbolDir” Name=”Demo” />

        </Directory>
      </Directory>
    </Directory>

    <Feature Id=”ProductFeature” Title=”SetupDemo” Level=”1″>
       <ComponentGroupRef Id=”Project” />

      <!– Note: The following ComponentGroupRef is required to pull in generated authoring from project references. –>
      <ComponentGroupRef Id=”Product.Generated” />
    </Feature>
  </Product>
</Wix>

 

And the associated (Demo.wxs) looks like

<?xml version=”1.0″ encoding=”UTF-8″?>
<Wix xmlns=”
http://schemas.microsoft.com/wix/2006/wi”>
    <Fragment>
    <DirectoryRef Id=”AppRootDir”>
      <Directory Id=”ComponentDir” ComponentGuidGenerationSeed=”DBA8384E-CE1B-41af-B573-4203FB8A6A3B”>
        <Directory Id=”Demo.Binaries” />
      </Directory>
    </DirectoryRef>
    <DirectoryRef Id=”AppSymbolDir”>
      <Directory Id=”SymbolsDir” ComponentGuidGenerationSeed=”35A3DCB8-4F85-4e3f-AC83-C51B78C04B94″>
        <Directory Id=”Demo.Symbols” />
      </Directory>
    </DirectoryRef>
    <ComponentGroup Id=”Project”>
      <ComponentGroupRef Id=”Demo.Binaries”/>
      <ComponentGroupRef Id=”Demo.Symbols”/>
    </ComponentGroup>
    </Fragment>
</Wix>

 

Tool

Link

Orca is available from here

http://support.microsoft.com/kb/255905

InstEd is available from here

http://www.instedit.com/home.html

Wix installer is available from here

http://wix.sourceforge.net/

Paraffin is available from here

http://www.wintellect.com/CS/files/folders/8198/download.aspx

Pin It

Comments are closed.