I'm trying to configure a WiX setup and library so that the version of one of the files in the library is used as the Product/@Version in the setup.
Background
In a setup with the files defined locally this is relatively straightforward in that assuming the component project is referenced by the WiX project and then configured:
<Component Id="Company.Assembly" Guid="[GUID]">
<File Id="Company.AssemblyFile"
Name="Company.Assembly.dll" KeyPath="yes"
DiskId="1"
Source="$(var.Company.Assembly.TargetPath)" />
</Component>
Then the product version can be set as
<Product Id="[GUID]"
Name="Product Name"
Language="1033"
Version="!(bind.FileVersion.$(var.Company.AssemblyFile
.TargetFileName))"
Manufacturer="Company Name"
UpgradeCode="[GUID]">
Issue
So having moved all the components to a WiX Library project it's no longer possible to directly reference the !(bind.FileVersion.$(var.Company.AssemblyFile.TargetFileName))
variable.
I've tried configuring a WixVariable in the library
WixVariable Id="BuildVersion" Value="!(bind.FileVersion.Company.AssemblyFile)"/>
And then reference that from the setup
<Product Id="[GUID]"
Name="Product Name"
Language="1033"
Version="!(wix.BuildVersion)"
Manufacturer="Company Name"
UpgradeCode="[GUID]">
Without success.
Is there some additional step or syntax required in either the library or setup to make the WixVariable (or some derivation of it) accessible from the setup?