WiX Heat tool cannot harvest info from executables - wix

Can anyone confirm that heat works only on DLLs, OCX, maybe some other files, but not on executable files?
The thing is, that I run heat on my COM components DLLs or OCXs (registered through regasm, regsvr32) and it harvests all data in the registry related to the file. However, I have DCOM servers that have lots of info related to themselves in the registry (self registered using /regserver) and the harvesting tool extracts just a minimal information about the file itself but nothing from registry related to the file, NOTHING. Like the resulted wxs file could be something like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="ohserver.exe" Guid="{E8D87743-45B6-459E-A72F-22D9A0D5CE16}">
<File Id="ohserver.exe" KeyPath="yes" Source="SourceDir\ohserver.exe" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
As you see nothing from registry, CLSIDs, ProgIDs, RegistryValues, etc.

That's correct. Heat does not support harvest self-reg data from .exe servers.

Related

Wixtoolset, specifying source to a file based on where the installer is

How do I specify the source of a file based on where the installer I am running is located. Say for example that I want to place a few files from the folder of the installer(that is for instance located on the desktop or in downloaded files) into a specified path in C/programfiles.
<ComponentGroup Id="ProgramFilesFolder_files" Directory="INSTALLFOLDER">
<Component Id="Program.exe" Guid="d0c868d9-4d5b-41f0-9ce8-d655ac80ee7c">
<File Id="Program.exe" Name="Program.exe" Source="???" />
How do I set the source property?
Have i understood it right that I am supposed to set the source to:
Source="..\Program.exe"
Does this refer to where the MSI file is run from. If I for example put my installer file along with the files I need the source for. Will I be able to use the code above as a relative path that changes when I move the installer. So I can run the installer from elsewhere, with the only requierment that the installer is in the same folder as the files I want to program the source for?
I have an open source project that makes authoring WiX installers easier. One of it's features is relative file paths. You can read about it here.
https://github.com/iswix-llc/iswix-tutorials
Essentially the project templates use an XPI called SourceDir to create an abstraction for where to find the source files. This is relative to the WXS file. The GUI tool uses the location of the WXS and the SourceDir to enumerate the source structure for drag / drop operations and then uses it to author the File elements like such.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ComponentRules="OneToOne"?>
<!-- SourceDir instructs IsWiX the location of the directory that contains files for this merge module -->
<?define SourceDir="..\Deploy"?>
<Module Id="DesktopApplicationMM" Language="1033" Version="1.0.0.0">
<Package Id="04cfbb1b-8105-4f3e-9b7a-c1d5354dc670" Manufacturer="DesktopApplicationMM" InstallerVersion="200" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" />
<Directory Id="MergeRedirectFolder">
<Component Id="owc17DECDE7A34AF545285829FF09EF24AE" Guid="4791fdfe-28ff-3c07-2f9e-e2f418c712f8">
<File Id="owf17DECDE7A34AF545285829FF09EF24AE" Source="$(var.SourceDir)\DesktopApplication.exe" KeyPath="yes">
<Shortcut Id="sc06A337B51AED2DF7E22F894A213D2792" Name="Desktop Application" Directory="DesktopFolder" />
</File>
</Component>
</Directory>
</Directory>
<ComponentGroupRef Id="Custom" />
</Module>
</Wix>
If you ever refactor where the files come from you only have one line to update.

Using files 'included' in a wixlib

We use a wixlib that has all the dialogs (most of which can be shared with other products on our portfolio).
One of these dialogs will show a EULA. This EULA is added to the wixlib project as (RTF) content (Build Action: Content, Copy to output: DontNotCopy)
Now next to showing the EULA, I must also install it with all the products.
Can I some how reference the EULA that (has to be?) is embedded in the wixlib?
Or do I need to copy this file to all the wixproj of all products? Given it's a EULA, which won't change that much, it's still a hassle if it does change. I trying to avoid that.
I'm guessing, I need to copy it to all products, but I wanted to double check.
In hindsight, I overthought this. I simply added the file to a component in the wixlib project which can be referenced from the consuming Wix project.
In the wixlib:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Component Id="C_General_EULA" Directory="INSTALLFOLDER" Guid="{INSERT_GUID}" KeyPath="yes">
<File Id="F_General_EULA" Source="Localization\EULA_en-us.rtf"/>
</Component>
</Fragment>
</Wix>
In the consuming Wix project:
<Feature Id="EULAFeature" Level="1" Display="hidden">
<ComponentRef Id="C_General_EULA"/>
</Feature>
Again, in hindsight really simple.

Creating an installer bundle using Wix Toolset

I've been asked to jump on a project and help build an installer. I'm normally a hardware guy so my coding experience is limited, especially when it comes to this particular instance.
Essentially I have a bunch of components: exe's, dll's, drivers, etc. that I would like to bundle together into one installer to deliver to the client. A coworker suggested using the Wix toolset to do this.
Most of the material I have found has only covered the very basics and it seems like I'm being asked to do something custom and a bit more nuanced. Any help in the form of some guidance on the most efficient/easiest way to do this would be a huge help. A rough outline of what I'll need to do and/or any examples would go a long way.
Thanks!
If you want to send a bundle of files, you can simply mention those specific files in Product.wxs file of wix setup project .
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="abc.exe" Guid="de34d0c6-3b9e-439c-a254-c9f695e2e389">
<File Id="abc.exe" Name="abc.exe" Source="$(var.abc_TargetDir)abc.exe" />
</Component>
<Component Id="abc.exe.config" Guid="3a38ad30-51ce-42fd-b262-1249c7087111">
<File Id="abc.exe.config" Name="abc.exe.config" Source="$(var.abc_TargetDir)abc.exe.config" />
</Component>
</Fragment>
Like the above abc.exe and the .config file, any other file can be sent using the component tag inside the ComponentGroup tag.

WiX: How do I run heat.exe with a multi-folder setup to get multiple WXS files?

I have a source file setup something like this: C:\Base, and in Base is FolderA, FolderB, FolderC, etc.... I want to run "heat dir" on each sub-folder in Base, so that I get one WXS file containing one ComponentGroup for each folder.
If I run heat (from C:)
heat dir Base\FolderA -cg FolderAGroup -gg -scom -sreg -sfrag -dr -var var.SourceDir INSTALLDIR -out Components-FolderA.wxs
(or 'heat dir FolderA ...' from C:\Base)
(Note that I'll run heat once per FolderA, FolderB, etc... from a script. I don't expect one heat statement to take care of all folders.)
Components-FolderA.wxs looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Directory Id="dirA..." Name="FolderA">
<Component Id="cmpF..." Guid="{GUID-HERE}">
<File Id="filB..." KeyPath="yes" Source="$(var.SourceDir)\RandomFile.txt" />
</Component>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="FolderAGroup">
<ComponentRef Id="cmpF..." />
</ComponentGroup>
</Fragment>
</Wix>
The problem with this is that Source="$(var.SourceDir)\RandomFile.txt uses whatever I specify as SourceDir. So if I designate C:\Base as SourceDir, the file RandomFile.txt can't be found because it's looking for C:\Base\RandomFile.txt, not C:\Base\FolderA\RandomFile.txt. I can't specify C:\Base\FolderA as SourceDir because FolderB, FolderC, etc... will be wrong. So how do I tell heat to insert 'FolderA\' in between '$(var.SourceDir)\' and 'RandomFile.txt'?
I have looked at Harvesting multiple directories in WiX, but the first answer is too much manual work (we're lookong for almost complete automation) and the second answer puts everything in one file under one ComponentGroup, which would be a maintenance nightmare as we have thousands of files and dozens of folders and sub-folders to be installed.

WiX Relative Path to the Source File

I have a simple Solution for my Project, which works well. But I am unable to grasp how to make the Source paths relative. Can somebody help me?
<Component Id="Bla.exe" Guid="*">
<File Id="Bla.exe" Source="D:\Projects\Bla\Bla\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
</Component>
How can I make the Path relative to the Wix Solution? WiX and all necessary files are in the same Solution.
You can use the relative path like so:
<File Id="Bla.exe" Source="..\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
OR
You can add a configuration file to your project to define common variables. To do so, add a new "WiX Include" file to your project, call it config.wxi. Then in your include file, you can define a SourceDir variable like so:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define SourceDir = "D:\Projects\Bla\Bla\bin\Debug" ?>
</Include>
Now in your .wxs file, you can add a reference to the config file at the top, ex:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include "config.wxi"?>
Then just reference your SourceDir variable like so:
<File Id="Bla.exe" Source="$(var.SourceDir)\Bla.exe" KeyPath="yes" Checksum="yes"/>
Also, there are some built in WiX project variables that you may use.
There are many ways to do this but personally what I like to do is put my application installer projects in different solutions. I build the application solution first and use postbuild commands to publish the content to a deploy folder.
In my installer projects I set $(var.SourceDir)="..\deploy" and then $(var.SourceDir)\foo.exe for a source path.