I am using WiX 3.8 to build a project which installs a product. The installer is basically done. One of the programmes which gets installed by the package is relying on dlls by a third party which get updated frequently. Idiotically the version number of the dlls change on a regular basis. When first writing the installer project I did not consider inculding support for changing file names and wrote every component manually.
This behaviour should be changed in the future. If I understand correctly, generating components for files automatically can be done with the help of the HeatDirectory Task. I now have created an example project using the HeatDirectory Task which is working. But there is some discrepancy in the output the HeatDirectory Task produces and the manually authored components I have been using in the past.
I would like the HeatDirectory Task to produce the same output as my manual approach, as good as possible. Following is the code of two components, first created manually and secondly created by the HeatDirectory Task:
Manually created components:
<ComponentGroup Id="ThirdParty.v13.2" Directory="INSTALLFOLDER">
<Component
Id="CMP_ThirdParty.v13.2.dll"
Guid="AC5E00F0-B458-4272-B132-F13594ED4916">
<File
Id="ThirdParty.v13.2.dll"
Name="ThirdParty.v13.2.dll"
Source="ComponentsDir\ThirdParty\ThirdParty.v13.2.dll"
KeyPath="yes"
Assembly=".net"
AssemblyApplication="ThirdParty.v13.2.dll"
AssemblyManifest="ThirdParty.v13.2.dll"
Compressed="no"
DiskId="$(var.ThirdPartyDiskId)"/>
</Component>
<Component
Id="CMP_ThirdParty.v13.2.xml"
Guid="64AC3F5F-38E9-41EC-B714-636F5D9C0CB4">
<File
Id="ThirdParty.v13.2.xml"
Name="ThirdParty.v13.2.xml"
Source="Source="ComponentsDir\ThirdParty\ThirdParty.v13.2.xml"
KeyPath="yes"
Compressed="no"
DiskId="$(var.ThirdPartyDiskId)"/>
</Component>
</ComponentGroup>
HeatDirectory Task generated code:
<ComponentGroup Id="Files">
<Component
Id="cmp9D064A733360960E07277CFD9AB84AF1"
Directory="INSTALLFOLDER"
Guid="*">
<File
Id="filD5DCB6E091D2D12303E2E80B0B767438"
KeyPath="yes"
Source="$(var.Path)\ThirdParty.v13.2.dll"/>
</Component>
<Component
Id="cmpA8681A63A8A4991D18824BA17E4CA4BF"
Directory="INSTALLFOLDER"
Guid="*">
<File
Id="fil17554B3CD0E576337AEC758831009938"
KeyPath="yes"
Source="$(var.Path)\ThirdParty.v13.2.xml"/>
</Component>
</ComponentGroup>
The code producing the output above is following:
<Target Name="BeforeBuild">
<HeatDirectory
DirectoryRefId="INSTALLFOLDER"
OutputFile="Files.wxs"
Directory="S:\omePath"
SuppressRootDirectory="true"
ToolPath="$(WixToolPath)"
AutogenerateGuids="true"
ComponentGroupName="Files"
PreprocessorVariable="var.Path">
</HeatDirectory>
</Target>
I'll now note down the characteristics of the HeatDirectory Task generated code I'd like to change:
- Every component in the componentgroup has a
Directory
attribute. I want the parentComponentGroup
to have theDirectory
attribute and omit it in every child component. - I want static guids.
- I want the component's
Id
attribute to be composed of the prefixCMP
followed by the file name. I understand that there cannot be two files having the same file name in the project but I know this is not the case. I don't want the cryptic identifier generated by the task. - The
File
child item of the component is too spartanic. I want the HeatDirectoy Task to create aName
attribute for every file which is the current name of the file. Then theCompressed
attribute should be added with the valueno
and theDiksId
should be added with a variable value that can be specified in the task somehow. - If the harvested file is a dll, the task should append the attributes
Asssembly
with the value.net
,AssemblyApplication
with the name of the harvested file as its value &AssemblyManifest
also with the name of the harvested file as its value.
Is it possible to achieve this with the HeatDirectory Task?