Announcement

Collapse
No announcement yet.

Ability to refresh directory tree automatically

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ability to refresh directory tree automatically

    Sorry if this is a FAQ, I tried to find this mentioned elsewhere, but couldn't (my google foo is weak I guess).

    I have a msifactory project with a nice big directory tree of files. Now sporadically the developers will add/remove files. Is there a way to have my automatic builds pick those up without me having to edit the project. Either a refresh or a "just include everything in this folder" would be great.

  • #2
    Just harvest the folder at build time instead of including the contents explicitly in the file list. Use the harvester (heat.exe) to create a WiX fragment for you, then include this fragment into your project at build time. In Setup Factory, you would use a folder reference. In Windows Installer (and MSI Factory), there is no such things so you use Heat.
    1. Use Heat to harvest the source folder and create WiX fragment.

      Example:
      Code:
      heat.exe dir D:\Downloads
      	-sfrag -srd -ag -cg MySubFolder -dr INSTALLDIR
      	-out directory.wxs -var var.SubFolderPath
      MySubFolder is the ComponentGroup name which will be associated with this sub folder.
      INSTALLDIR is the folder reference where these files should be deployed (in this sample, the target folder itself).
      If there are sub folders in the source, they will be created in the target folder.

      This task can be performed in a batch, in the "Before build" step.
    2. Include the WiX fragment in the MSI Factory project.

      Build Settings > Fragments > Add "directory.wxs" file. In the main WXS insertions, add
      Code:
      Insertion type: "Last Child"
      	Target: "/Wix/Product/Feature"
      	Text to insert: "<ComponentGroupRef Id="MySubFolder"/>"
    3. Add the variable definition to the compiler (candle.exe):

      -dSubFolderPath=D:\Downloads
    4. Build and test. You will set up this once, and afterwards just rebuild the project when the folders are updated with new content. The new WiX fragment will reflect the changes.


    Ulrich
    Last edited by Ulrich; 10-04-2022, 03:19 PM. Reason: Removed color coding which no longer works in the forum

    Comment


    • #3
      Awesome... thx for the quick response. I just found heat on google, so this saves me a lot of time :-).

      Comment

      Working...
      X