2

I am someone with little to no experience with wix and I am trying to support Windows also for the component I am responsible for. I am trying to create merge module for a set of files that my product generates. These files exist in numerous sub directories. I was wondering how I can create a single component ID for all the files in the entire tree. I am not worried about minor upgrades as that is something I am not going to be doing. I am trying to avoid generating numerous GUIDs for each of the file.

Also is there any way I can change the name of the root directory I want the files to be installed. Currently, in our build system the files I want to install end up in a directory name "install". In the wxs file generated by heat it comes up as install. I was wondering if I could change it to the actual product name instead of "install".

tuxalot
  • 313
  • 4
  • 11
  • 1
    Did you try the -dr flag on heat to specify the root directory? heat -help provides a lot of controls you can use, and if that is not enough, you can pass the output through a xsl transform. – Dave Andersen Mar 21 '14 at 07:55
  • Why "avoid generating numerous GUIDs"? They are free. But they are generally meaningless, which is why, in many scenarios, WiX will generate them for you at build time (`candle`, not `heat`). See `heat -ag`. – Tom Blodget Mar 23 '14 at 04:40

2 Answers2

2

Use one file per component - this avoids all sorts of problems (except .NET assemblies spanning multiple files). See the following thread: One file per component or several files per component?

Wix is a great framework for creating installers, but it has a steep learning curve. I strongly recommend you read a few sections of this great, online tutorial: https://www.firegiant.com/wix/tutorial/

If you are a "sample based tinkerer", you can find an even quicker, sample based tour in this article: http://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with

Wix is hands-on. Just focus on the samples, and focus on getting the components created and a major upgrade set up:

Once you got that running the rest of the details fall into place by reading the documentation for whatever feature you need. Using Visual Studio / Votive with intellisense ensures that you can learn as you go with features such as shortcuts, ini files, xml files, dialogs, etc...

Another top tip is to use dark.exe (part of the Wix toolkit) to decompile existing MSI files. This yields Wix XML with code you can copy and paste into your own Wix files. I use other MSI tools to compile such MSI files, and then copy the sections I need into my Wix file - just to speed up the process of creating the Wix XML. Studying the decompiled XML is very educational - a real time saver.


UPDATE, May 2021: Some more links:

  1. WiX Quick Start - Very long version
  2. WiX Quick Start - Short version
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • 1
    An exception to "one file per component" is one component per .NET assembly. Files that constitute an assembly are functionally inseparable and only one has a version. – Tom Blodget Mar 23 '14 at 04:32
  • Yes, look out for these special cases, but go one file per component if you can. There are also some "file replacement tricks" that are used to ensure unversioned files update by putting them with a versioned file. For these cases it is better to use a companion file. See this link: http://stackoverflow.com/questions/1432251/forcing-an-upgrade-of-a-file-that-is-modified-during-its-initial-installation – Stein Åsmul Mar 23 '14 at 04:52
-1
  1. If all the files are going to the same destination folder, then you can create one single COMPONENT with all the FILE within it. There is nothing stopping you to do that. You can then just create one GUID for that component. Also read these answers which talks about the advantages vs disadvantages of one component vs multiple components before you implement it: Answer1 Answer2. To Summarize:

You will have trouble with minor upgrades/repairs. If a component is being updated, only the file designated as the KEYPATH is checked to see if it is out of date: if it is up to date, all the others are ignored.

You'll also have difficulty if you want to add or remove files from each component. Once released, a component is immutable (in terms of what files are in it). The only way to update it without breaking component rules would be to effectively remove and install the a new version of the MSI. Understanding the component rules is key in Windows Installer and one file per component makes the component rules easier to work with, which is why it is the recommendation of many people here.

LINK

  1. The root directory name can be changed by modifying the "Name" property for the DIRECTORY element.
Community
  • 1
  • 1
Isaiah4110
  • 9,855
  • 1
  • 40
  • 56
  • Thanks for your answer. I was wondering how can I do this automatically from the command line using heat to generate the wxs file. Currently heat is create a component per file. Are there any tools that I can use to create the wxs file this way. I have a large number of files and manually creating them just does not seem to be scalable. – tuxalot Mar 21 '14 at 01:34
  • Reading more about it, I feel you are better off with multiple component than using a single component. Read the update in the answer. – Isaiah4110 Mar 21 '14 at 02:25
  • I won't downvote this, but sorry - this is just not good advice. One component per file is a must if you want to prepare your package for future changes and upgrades. You never know when those will be needed. – Stein Åsmul Mar 21 '14 at 04:36
  • @glytzhkof Did you read the whole answer, I have called out the disadvantages. – Isaiah4110 Mar 21 '14 at 10:01
  • @Isaiah4110 Yes, that's why I didn't down-vote, but it still wasn't clear just how bad an idea a single component really is for someone who is new at this. – Stein Åsmul Mar 21 '14 at 16:05