WiX Learning Resources: A couple of links to resources on WiX:
WiX Preprocessor Variables: What is SourceDir? Rob Mensching (WiX creator) on SourceDir.
As explained here you can change SourceDir to a compiler variable:
Heat.exe: Something like this:
"%WIX%bin\heat.exe" dir . -sfrag -suid -ag -var MyReleasePath -out MySource.wxs
You will get something like this:
<!-- Extract -->
<Component Id="MyFile.exe" Guid="*">
<File Id="MyFile.exe" KeyPath="yes" Source="$(MyReleasePath)\MyFile.exe" />
</Component>
<!-- End of Extract -->
WiX Sample: Then you insert this into your source. Something like this:
<!-- START OF COMPILER VARIABLES: -->
<?define MyVersion = "1.0.0.0" ?>
<?define MyReleasePath = "C:\My Releases\Wix Testing\" ?>
<!-- END OF COMPILER VARIABLES: -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="WiX Testing" Language="1033" Version="$(var.MyVersion)"
Manufacturer="WiX Testing" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- Enable line below for GUI in MSI -->
<!-- <UIRef Id="WixUI_Mondo" /> -->
<MediaTemplate EmbedCab="yes" />
<Feature Id="Main" Title="Main Feature" Level="1" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="WiX Testing">
<!-- Essential part follows: -->
<Component Feature="Main">
<File Source="$(var.MyReleasePath)MyFile.exe"></File>
</Component>
<!-- End of Essential part -->
</Directory>
</Directory>
</Directory>
</Product>
</Wix>
Batch File Compile: Visual Studio takes care of most of the build issues once you have defined the variables. If you want to compile "manually", here is a quick sample:
"%WIX%bin\candle.exe" MySource.wxs -ext WixUIExtension >> Build.log
"%WIX%bin\light.exe" -out Test.msi MySource.wixobj -ext WixUIExtension >> Build.log
Links: