I'm trying to use the binding "bind.fileVersion" from Wix3. (ie: 3.11.1)
For some me reason, I get the following error message:
Unresolved bind-time variable !(bind.fileVersion.TestWix3.exe).
My goal is to fill the 'Product Id' line. Especially the Version="$(var.VERSION)" information.
Here's the content of my "Product.wxs" file:
<?xml version="1.0" encoding="UTF-8"?>
<?define LongName = "Test wix 3" ?>
<?define Manufacturer = "Test" ?>
<?define ProductUpgradeCode = "5fc3e435-fad3-4c1d-997f-3483beffe0a4" ?>
<?define MAINEXE=$(var.TestWix3.TargetFileName)?>
<?define VERSION="!(bind.fileVersion.$(var.MAINEXE))"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.LongName)" Language="1036" Codepage="1252" Version="$(var.VERSION)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.ProductUpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="Wix3Installer" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Wix3Installer" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
</ComponentGroup>
</Fragment>
</Wix>
Here is the screenshot of my solution in VS2017 Community.
Any idea why the binding of (bind.fileVersion) does not work ?
The FileId part of the bind variable is representing the <File Id="...">
Id. ie:
!(bind.fileVersion.TestWix3.exe)
...
<Component Id="MainProduct">
<File Id="TestWix3.exe" KeyPath="yes" Source="$(var.TestWix3.TargetPath)"/>
... other stuff maybe ...
</Component>
Currently your component and file definitions are TODO
so you can't use this type of bind variable yet.