The guid autogeneration is based on the keypath including directory path from a well-known directory. What you have is several components, all of which have the exact same directory, and ending in the exact same filename. Given that, they will all get the same auto-guid (that way, they are stable).
You must change either something in the directory (path), or the filename, to get different guids, if you wish to use autogen guids. If you absolutely require the same filename in the same directory, you will need to generate your own component guids for each environment. As an example, if you have defined Environment1, Environment2 and Environment3 as your values in your ENVIRONMENTList and GUID1, GUID2 and GUID3 are three different guids you generated for those three components: <?define Guid.Environment1=GUID1?> <?define Guid.Environment2=GUID2?> <?define Guid.Environment3=GUID3?> You can start your example code like this: <?foreach ENVIRONMENT in $(var.ENVIRONMENTList)?> <Component Id="InstallConfig.$(var.ENVIRONMENT)" Guid="$(var.Guid.$(var.ENVIRONMENT))"> ... Blair -----Original Message----- From: Pound, Robert (CDC/OCOO/ITSO) (CTR) [mailto:u...@cdc.gov] Sent: Thursday, December 30, 2010 5:51 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Creating Unique GUIDs inside a foreach block? I'm using VS2010, WiX version 3.6.1112.0. The following snippet of code is used to generate a 1-n # of components, based upon value of EnvironmentList variable. It works ok with 1 entry in EnvironmentList. However when EnvironmentList contains 2 or more entries I get an ICE08 error on the component stating that it has a duplicate GUID. It seems that the Guid="*" is not creating a new GUID on each iteration of the foreach loop by the preprocessor. In this scenario, how can I generate a unique GUID for use within a foreach loop? <?foreach ENVIRONMENT in $(var.ENVIRONMENTList)?> <Component Id="InstallConfig.$(var.ENVIRONMENT)" Guid="*"> <Condition><![CDATA[USENVIRONMENTCONFIGFILE = "yes" AND PROP.INSTALL.ENVIRONMENT = "$(var.ENVIRONMENT)"]]></Condition> <File Id='file.config.$(var.ENVIRONMENT)' Name='web.config' Source="$(var.SourceDir)web.config.$(var.ENVIRONMENT)" DiskId='1'/> </Component > <?endforeach?> Thanks, Bob ---------------------------------------------------------------------------- -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users