Вопрос

Hello all my fellow WiX'ers,

I was wondering if it possible, and if so where I can go to learn how to do it, to run heat on a directory and have each directory inside that one be it's own Component Group.

Example:

  • Root Directory
    • Sub Dir 1
      • Sub Sub Dir 1
      • Sub Sub Dir 2
      • Sub Sub Dir 3
    • Sub Dir 2
      • Sub Sub Dir 1
      • Sub Sub Dir 2
      • Sub Sub Dir 3
    • Sub Dir 3
      • Sub Sub Dir 1
      • Sub Sub Dir 2
      • Sub Sub Dir 3

Then run a heat command in the Build Event of the VS2010 project (example below):

heat dir "Root Directory" -gg -sfrag -srd -dr INSTALLFOLDER -out MyWXS.wxs

and then have that WXS file structured like so:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
   <Fragment>
      <DirecotryRef Id="INSTALLFOLDER">
         <Directory Id="dir84156489" Name="Sub Dir 1"> ... </Directory>
         <Directory Id="dir84156489" Name="Sub Dir 2"> ... </Directory>
         <Directory Id="dir84156489" Name="Sub Dir 3"> ... </Directory>
     </DirectoryRed>
   </Fragment>
   <Fragment>
      <ComponentGroup Id="Sub Dir 1"> ... </ComponentGroup>
      <ComponentGroup Id="Sub Dir 2"> ... </ComponentGroup>
      <ComponentGroup Id="Sub Dir 3"> ... </ComponentGroup>
   </Fragment>
</wix>

If there is any confusion in my question or if anyone has any additional questions for me please let me know. Thank you and I look forward to hearing from you.

EDIT Using the following xslt file I am getting the WXS structure that follows after:

**XLST File**

<?xml version="1.0" encoding="utf-8"?>

**WXS File Result**

<Wix>
   <Fragment>
      <DirectoryRef Id="INSTALLFOLDER">
         <Directory Id="dir846546" Name="SubDir1"> ... </Directory>
         <Directory Id="dir846546" Name="SubDir2"> ... </Directory>
         <Directory Id="dir846546" Name="SubDir3"> ... </Directory>
      </DirectoryRef>
   </Fragment>
   <wix:Fragment xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
      <wix:ComponentGroup Id="SubDur1"> ... </wix:ComponentGroup>
   </wix:Fragment>
   <wix:Fragment xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
      <wix:ComponentGroup Id="SubDur2"> ... </wix:ComponentGroup>
   </wix:Fragment>
   <wix:Fragment xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
      <wix:ComponentGroup Id="SubDur3"> ... </wix:ComponentGroup>
   </wix:Fragment>
</Wix>

No matter what I do I cannot get the Directories to be created as component groups...

Это было полезно?

Решение

Heat can do an XSL transform before emitting its output. Just add the -t transform.xsl argument.

All that's needed is to append a few component groups to the output. Generate a component group by matching on a first-level directory and then referencing all of the descendent components.

See the XSL for my answer to a similar question.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top