I have WiX code like this:
<DirectoryRef Id="MyShortcutsDir">
<Component Id="CMP_StartMenuShortcuts" Guid="62A9F5D2-F9D9-4F9B-8382-D470E11B2332">
<Shortcut Id="docEng" Name="UFCOM user guide - ENG (pdf)" Target="[INSTALLFOLDER]UFCOM user guide - ENG.pdf" />
<Shortcut Id="docChs" Name="UFCOM user guide - CHS (pdf)" Target="[INSTALLFOLDER]UFCOM user guide - CHS.pdf" />
<Shortcut Id="UninstallShortcut" Name="Uninstall [ProductName] ~ [ProductVersion]" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" Description="Remove UFCOM from your Windows" />
<RemoveFolder Id="RemoveMyShortcutsDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Newland Auto-ID\UFCOM" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<!-- On Win7, these shortcuts(.lnk) resides in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\UFCOM" -->
</Component>
</DirectoryRef>
But I find that [ProductCode] can be expaneded while [ProductName] can not, why is it so? Then how to reference product name define in element?
<Product Id="*" Name="UFCOM Driver 1.3.6" ... >
</Product>
Answer: Giving a name to a product is not enough as it is also necessary to imbibe the product with certain values that a customer can identify with. Creating such a link between the customer and the product will enable him/her to make a positive choice about purchasing the product.
It's part of making the right first impression It's the first thing your customer will interact with when they're looking for the right product or service to solve their issue. A high-quality name is memorable, and it helps your customer to identify you.
Product name means a name, designation or trademark that identifies a product.
A product is made by a company and can be purchased by a consumer in exchange for money while brands are built through consumer perceptions, expectations, and experiences with all products or services under a brand umbrella. For example, Toyota's product is cars.
Property names in square brackets are only expanded by the MSI installer for data in Formatted column types in the MSI database. The expansion happens when the product is installed.
In the Shortcut table in the MSI database:
[ProductCode]
will be expanded when the product is installed.[ProductName]
and [ProductVersion]
will not be expanded when the product is installed.You could use WIX properties, which are expanded during the WIX build process. For example:
<?define ProductName='My Product Name' ?>
<?define ProductVersion='X.Y.Z' ?>
<Shortcut Id="UninstallShortcut"
Name="Uninstall $(var.ProductName) ~ $(var.ProductVersion)"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Remove UFCOM from your Windows" />
Properties in brackets are expanded in "formatted" attributes. For shortcuts, Shortcut table defines that Arguments is formatted but the Name is not.
You may define a variable
<?define MyProductName = "UFCOM Driver 1.3.6" ?>
and then use it in both Product/@Name and Shortcut/@Name:
<Product Name="$(var.MyProductName)"
<Shortcut Name="Uninstall $(var.MyProductName)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With