WIX: get version of setup upto buildversion - wix

We can get the productversion in wix using !(bind.fileVersion.Product.exe). This returns the version as 3.8.2363.0. How can I get the version up to build version, i.e. 3.8.2363.
I followed Binding WIX FileVersion sub values? this link, but using
"!(bind.property.ProductVersion.Major)" do not solve my problem.
<?define ProductVersion123="!(bind.fileVersion.mainexe_dll)" ?>
<Product Id="{7BDF78BF-95E8-4ABB-8A0F-4A1483D7FDD1}" Name="SpreadsheetConverter !(bind.property.ProductVersion123.Major)" Language="1033" Version="!(bind.property.ProductVersion123.Major)" Manufacturer="ABC" UpgradeCode="$(var.ProductUpgradeCode)" Codepage="1252">
This gives error:
Unresolved bind-time variable Mainexe !(bind.property.ProductVersion123.Major).
Please Help.
Thanks

You have to realize what !(bind.property.X) does. It retrieves the value of the X property from the MSI's Property table. You have not setup a ProductVersion123 property in the MSI, you have created a WiX preprocessor variable ProductVersion123.
So what you have to do is assign the Product's Version attribute to $(var.ProductVersion123) (which sets the ProductVersion property of the MSI). Now you can access that with !(bind.property.ProductVersion), including the !(bind.property.ProductVersion.X) extensions.

Related

How to Assign string in version attrbute of WIX project

I am having installer with version 1.2.3.4, which is hardcoded in wxs file as below:
<Product Id="B91BEF19-0975-DB9185E716FC" Name="Installer" Language="1033" Version="1.2.3.4" Manufacturer="XX" UpgradeCode="c2a8ba27-bb8-186cbcd4d743">
Now i need to change the version like "1.2.3.4_temp".i.e, assigning the string to version.
As we know version attribute takes x.x.x.x and x as integer.
Is any way to get the version as 1.2.3.4_temp?
Is any way to assign ProductName (as xxxx) to version in wxs file?
You need to use product version as a numeric value.
Though Wix toolset documentation says Version attribute as The product's version string, you need to look up at the Windows Installer documentation for details about Version attribute.
It says for ProductVersion : "String format of the product version as a numeric value. (Required)"
For details about ProductVersion, please go to this link.

How to access a property value in MSI within MSM (Merge module)

I'm currently implementing a wix(3.8) installer and the main MSI is merged with several other merge modules. I'm taking a user input during the installation and I store it in a global property called PORT like this.
In the MSI
<Property Id='PORT' Value="1">
I need to access this property value inside a condition in my merge module to edit a XML file if that condition is true. So I passed this property to the merge module as a configuration like this.
In MSI
<ConfigurationData Name="PROTOCOL" Value="[PORT]" />
In MSM
<Property Id="protocol"/>
<Configuration Name="PROTOCOL" Format="Text" DefaultValue="[protocol]"/>
<Substitution Table='CustomAction' Row='SetProtocol' Column='Target' Value='[=PROTOCOL]'/>
<CustomAction Id='SetProtocol' Property='protocol' Value='[protocol]'/>
I used the value of the property "protocol" inside my condition as below but the condition never executes.
<Condition>protocol = 1</Condition>
I tried by appending the property id with the merge module's GUID as well like this and accessing that property "NEWPORT" inside the condition. but didn't success.
<Property Id='NEWPORT' Value='[protocol.8c2910c9-5694-4312-a4cc-c9b2c2a5caa5]'/>
What would be the reason for this ? Can someone please tell me the way to access the property value in MSI within Merge module's condition element.
Thanks in advance.

How change details of an exe file using wix bootstraper?

I have a Visual Studio bundle file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle
Name="Some Name"
Version="3.2.2"
Manufacturer="Some Company"
Copyright="Copyright: Some Company, Inc">
...
</Bundle>
</Wix>
After build exe details menu contains two parameters (File description and Product Name) and these parameters have the same value. There is a way make these values different using only WIX functionality?
As of Wix Version 3.10.2, you cannot set different values for the ProductName and FileDescription fields of the exe file description resource.
Looking at the WIX source code, specifically the file src\tools\wix\Binder.cs from WIX310-Debug.zip downloadable from here, shows the following code fragment for setting the exe file's resources:
Microsoft.Deployment.Resources.VersionStringTable strings = version[1033];
strings["LegalCopyright"] = bundleInfo.Copyright;
strings["OriginalFilename"] = Path.GetFileName(outputPath);
strings["FileVersion"] = bundleInfo.Version; // string versions do not have to be four parts.
strings["ProductVersion"] = bundleInfo.Version; // string versions do not have to be four parts.
if (!String.IsNullOrEmpty(bundleInfo.Name))
{
strings["ProductName"] = bundleInfo.Name;
strings["FileDescription"] = bundleInfo.Name;
}
Notice that ProductName and FileDescription are set to the same value.
If this is important you could request a new feature via the WiX issue tracking database: https://github.com/wixtoolset/issues/issues.

WiX - Show product version in instance productname?

I can define a product version variable like so :
<?define ProductVersion="!(bind.FileVersion.ServiceExeFile)" ?>
which I can reference inside string parameters like this :
$(var.ProductVersion)
..but it is displayed as literal text if I use it in my InstanceTransforms productName parameter.
Can anyone suggest how I might work around this?

WiX InstanceTransforms element produces unresolved reference

I am trying to create a multi-instance setup and followed this question and answers to make it:
Use WIX to install side by side versions of the same IIS site
So I inserted this to my product.wix file
<InstanceTransforms Property="INSTANCEID">
<Instance Id="I01" ProductCode="{68E8345E-0B22-479C-B7A5-7D1B3DC2F835}" ProductName="My Product 01"/>
<Instance Id="I02" ProductCode="{A0E37B8D-12AB-42A0-8F11-9CB08F54B9DE}" ProductName="My Product 02"/>
</InstanceTransforms>
However, when I build my setup project, I get this error:
Unresolved reference to symbol 'Property:INSTANCEID' in section
'Product:{38EEE9BE-86BF-49FB-813B-953DD945575E}'.
Where 38EEE9BE-86BF-49FB-813B-953DD945575E is my main Product Id.
I could not find any reference to this error in the InstanceTransform scope. What am I doing wrong?
UPDATE:
The first thing I tried when I got this error was of course creating a property inside my product with that is called INSTANCEID and some value. However, the error persisted.
I added the Yan's code from his comment below and it compiled. I am not sure what was wrong with my property.
You need a Property element with the Id of your InstanceTranforms/#Property value.