Hey Samer,

Just reading over the WiX documentation for Component@GUID values here:
http://wixtoolset.org/documentation/manual/v3/xsd/wix/component.html

This value should be a guid that uniquely identifies this component's contents, 
language, platform, and version. If omitted, the default value is '*' which 
indicates that the linker should generate a stable guid. Generatable guids are 
supported only for components with a single file as the component's keypath or 
no files and a registry value as the keypath. It's also possible to set the 
value to an empty string to specify an unmanaged component. Unmanaged 
components are a security vulnerability because the component cannot be removed 
or repaired by Windows Installer (it is essentially an unpatchable, permanent 
component). Therefore, a guid should always be specified for any component 
which contains resources that may need to be patched in the future.


Basically, Basically, Basically, you could create a GUID manuall in the 
component.  Having a unique prefix or something in a map based on $(var.INST) 
if the values of INST don't fit within a GUIDs character set.  Someone may have 
even made a dictionary wix extension that would help you accomplish this.
Example:
   <?foreach INST in $(var.InstList)?>
      <Component Id="Application.exe_$(var.INST)" Directory="DIR_$(var.INST)" 
Guid="F9884964-4A3C-4974-$(var.INST)-AE25DF520FC4">
        <Condition><![CDATA[INSTANCE="$(var.INST)"]]></Condition>
        <File Id="application.exe_$(var.INST)" Name="Application.exe" 
KeyPath="yes" Source="PARENT_FOLDER/Application/Application.exe" />
      </Component>
    <?endforeach?>

-----Original Message-----
From: Samer Vazdekis [mailto:sbazd...@yahoo.com] 
Sent: May-26-15 11:22 AM
To: WiX-users@lists.sourceforge.net
Subject: [WiX-users] Generating unique and stable GUIDs in foreach loops

Hi there,
I have a question about the following piece of Wix code. I am finding that all 
components added by the following foreach loop has the same GUID. Is there a 
way to guarantee a unique and stable GUID for each competent and still use the 
foreach loop?

   <?foreach INST in $(var.InstList)?>
      <Component Id="Application.exe_$(var.INST)" Directory="DIR_$(var.INST)" >
        <Condition><![CDATA[INSTANCE="$(var.INST)"]]></Condition>
        <File Id="application.exe_$(var.INST)" Name="Application.exe" 
KeyPath="yes" Source="PARENT_FOLDER/Application/Application.exe" />
      </Component>
    <?endforeach?>

Thanks,Samer.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest 
out-of-the-box monitoring support with 50+ applications Performance metrics, 
stats and reports that give you Actionable Insights Deep dive visibility with 
transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to