I need to create an MSI for distribution, the old story but new situation. I don't use Visual Studio, only the Wix Toolset (3.11.2.4516). My files are under the msi folder:
MyFolder
|
---msi
| |
| ---Sample1.txt
| |
| ---Sample2.txt
|
---build.bat
|
---Product.wxs
Basically, I do harvest those files from the msi folder into an msi.wxs:
heat dir msi -cg MsiFilesGroup -dr MsiDir -gg -sfrag -srd -out msi.wxs
and I get a ComponentGroup called MsiFilesGroup. The main part (Product.wxs) defines an interactive WixUI to guide the user during the installation.
These Product.wxs defines a feature what references the above files:
<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="B858BC76-AD11-45c3-A300-D1C6B73DFF56" Name="Pruders" Language="1033" Version="0.0.0.0"
UpgradeCode="{FA34F953-F659-4633-B8D2-893BF7A63642}" Manufacturer="Microsoft Corporation">
<Package Description="Test WIXUI_INSTALLDIR" Comments="TestWIXUI_INSTALLDIR"
InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Feature Id="TestFileProductFeature" Title="Test File Product Feature" Level="1">
<ComponentRef Id="MsiFilesGroup" />
</Feature>
<Property Id="SQLCLRTYPES">
<RegistrySearch Id="SqlClrTypesSearch" Root="HKLM" Type="raw"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Name="KeyName1"/>
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<Property Id="buttonGroup" Value="1" />
<UIRef Id="WixUI_InstallDir" />
</Product>
</Wix>
If I use ComponentRef for referencing I get this error:
error LGHT0094 : Unresolved reference to symbol 'Component:MsiFilesGroup'
in section 'Product:{B858BC76-AD11-45C3-A300-D1C6B73DFF56}'
If I use ComponentGroup, it fails in this way:
Product.wxs(8) : error CNDL0005 : The Feature element contains an unexpected child element 'ComponentGroup'.
light.exe : error LGHT0103 : The system cannot find the file 'Product.wixobj' with type 'Source'.
Any hint would be a greate help.
The build.bat contains the calls of Wix commands, as it follows:
@echo off
del *.msi
del *.wix*
del msi.wxs
heat dir msi -cg MsiFilesGroup -dr MsiDir -gg -sfrag -srd -out msi.wxs
candle msi.wxs
candle Product.wxs
light -ext WixUIExtension msi.wixobj Product.wixobj -out Product.msi
It is the light.exe
command that you are lacking, and there are a number of other things you need to adjust as well.
Here are two slightly modified and simplified batch and WiX sources. Notice the two *.wixobj
files fed to light.exe
and the -var var.sourcefolder
added in there to set the source directory:
Suggested "Build.cmd":
@echo off
heat dir msi -cg MsiFilesGroup -dr INSTALLFOLDER -gg -sfrag -srd -suid -var var.sourcefolder -out msi.wxs
candle -dsourcefolder="msi" msi.wxs >> Build.log
candle Product.wxs >> Build.log
light -ext WixUIExtension Product.wixobj msi.wixobj -out Product.msi >> Build.log
rem pause
Suggested (simplified) "Product.wxs" - I find that only the Mondo dialog set is working "on its own" without any modification or fiddling:
<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="B858BC76-AD11-45c3-A300-D1C6B73DFF56" Name="Pruders" Language="1033" Version="0.0.0.0"
UpgradeCode="{FA34F953-F659-4633-B8D2-893BF7A63642}" Manufacturer="Microsoft Corporation">
<Package Description="Test WIXUI_INSTALLDIR" Comments="TestWIXUI_INSTALLDIR"
InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Feature Id="TestFileProductFeature" Title="Test File Product Feature" Level="1">
<ComponentGroupRef Id="MsiFilesGroup" />
</Feature>
<UIRef Id="WixUI_Mondo" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Test Folder" />
</Directory>
</Directory>
</Fragment>
</Wix>