Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write Product Id in registry in wix

Tags:

wix

My requirement is blow. I need to write the Product Id in registry while install the setup. I have the below code for Product Id.

<Product Id="{CEEE7807-F6D7-43F6-A206-110B9E25AC9C}" 
         Name="Sample installer" 
         UpgradeCode="{BFBD4770-8C5D-4A53-BA07-EF52401F0CB4}" 
         Language="1033" 
         Version="$(var.ProductVersion)" 
         Manufacturer="My company.">

I have below code for write Registry. I want to pass the product Id value here.

<Component Id="registry_values" Guid="{11FB6C4C-3C90-4F46-B0D2-BB95150F60E6}">
    <RegistryValue 
         KeyPath="yes" 
         Root="HKCU" 
         Key="Software\MyProduct\Myfolder\SampleFolder\Product" 
         Value="[Product Id]" 
         Type="string" />
</Component>

Please help me to solve this problem.

like image 966
Vinoth Avatar asked Jan 10 '12 13:01

Vinoth


People also ask

What is product WXS file?

Product. wxs is the source file of your setup project. A newly created project contains the XML code shown below.

What is KeyPath in Wix?

The KeyPath for a Component is a single resource that the Windows Installer uses to determine if a Component "exists" on a machine. This means that when Windows Installer decides whether to install your component, it will first look whether the keypath resource is already present.

How do you create a WIX file?

Click File, then select New, then select Project. Choose the Visual C# node in the Project Types tree, then select Windows Forms Application. Name your application "MyApplication" and press OK.


1 Answers

Somewhat confusingly, the Id attribute of the WIX Product element maps to the Windows Installer ProductCode property.

<Component Id="registry_values" Guid="{11FB6C4C-3C90-4F46-B0D2-BB95150F60E6}">
    <RegistryValue 
         KeyPath="yes" 
         Root="HKCU" 
         Key="Software\MyProduct\Myfolder\SampleFolder\Product" 
         Value="[ProductCode]" 
         Type="string" />
</Component>
like image 101
Daniel Pratt Avatar answered Nov 15 '22 11:11

Daniel Pratt