Thanks for the quick reply.

#1.  The condition statement under the component will, in my case, take care on 
only 1 of these files ( and GUID) actually being installed.
#2.  The "behind the scenes"purpose of this fragment, is to simplify the work 
for developers and reduce effort in building the installer package.  In theory 
all the developer would need to do is specify the environments that have a 
unique file  (in this case a web/app config file).  At install time I have a 
custom dialog which allows the installer to select the environment (setting the 
property PROP.INSTALL.ENVIRONMENT ).  The the wix msi process determines which 
of the several config files should actually be installed.  In my case we have 
config files with settings for each of a number of environments.  sometimnes an 
application will use 2 environments, other apps may use 8 environments.  this 
snippet (except for the GUID issue) would allow me to include all of the 
environment config files, but only install the correct one, based upon the 
environment the installer had selected.  Without this approach each developer 
for each application will have to hard code the specific files and 
environments.  If the environments increase or decrease for the app, he/she 
will have to add/remove statements from the product.wxs file.  The approach I 
was striving for was that the developer simply defined a variable containing 
the environments the app would install in.  Any increase or decrease in apps 
would only require a simple change to the define variable statement.

Thanks,
Bob

________________________________________
From: Peter Shirtcliffe [pshirtcli...@sdl.com]
Sent: Thursday, December 30, 2010 9:45 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Creating Unique GUIDs inside a foreach block?

Guids are generated not by the pre-processor but much later by
light.exe. * Guids are derived from the component keypaths which are all
the same in the generated code.

There are a couple of posts on this list stating that foreach was
supposedly deprecated: there are some problems associated with
generating components. Generating multiple guids for the same file can
be dangerous. You'll end up with different guids attached to the same
file through different components. Thats a violation of the component
rules *unless* you can guarantee only one of the components is ever
going to be installed on a particular machine (all conditions are
mutually exclusive). Not having consistent guids from build to build is
also a possible source of problems.

If youre aware of all the pitfalls and can be sure they won't affect you
now or in all your servicing scenarios (upgrades and patches), you
should be able to accomplish your aim by including a registry value in
each component with the keypath set to yes and whose path includes the
loop index variable. This would ensure each generated guid is consistent
between builds and unique. It will be hard to patch since the keypath
isn't the file and a registry path doesn't have a version or file hash.

If it was me and the number of components isn't too large and doesn't
change often, Id hard code them all. That way, when you want a change,
you have to do it deliberately and you're less likely to be caught by
surprise.


-----Original Message-----
From: Pound, Robert (CDC/OCOO/ITSO) (CTR) [mailto:u...@cdc.gov]
Sent: 30 December 2010 13:51
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
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.


------------------------------------------------------------------------------
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

Reply via email to