Wrap the <SetProperty>s with <?foreach...?> for the "common" ones AND the
ones that vary based solely on the name of the environment?

<?foreach env in DEVELOPMENT;PRODUCTION?>
<?if $(var.env) = "DEVELOPMENT"?>
<?define shortEnv = "DEV">
<?elseif $(var.env) = "PRODUCTION"?>
<?define shortEnv = "PROD">
<?endif?>

<SetProperty Id="USER_DOMAIN_PROP" Value="DOMAIN$(var.shortEnv)" ...>
      <![CDATA[%ENVIRONMENT = "$(var.env)"]]>
</SetProperty>

<?undef shortEnv?>
<?endforeach?>

Note: this is a quick-and-dirty example. I haven't compiled it, but is
should basically be what you are looking for.

-----Original Message-----
From: Maillet, Ed [mailto:email...@unum.com] 
Sent: Tuesday, August 25, 2009 7:01 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Dynamic Property Values vs. Multiple Components

Hey all,
   Looking for some direction and opinions. I need to create an hands
free (no UI/prompting etc) MSI that installs Web Site and app pool on
IIS 6.0. The catch is that the user info and host header info need to be
derived based on an environment variable on the target machine. I have
10 different environments (DEV, PROD, STRESS, etc). The mapping between
environment variable and the other info is static (e.g. env = A always
yields Header = X, etc)

It seems more natural to me to have properties who's values get set at
runtime rather than multiple components with conditions (or Features
with conditions)

Unless I'm missing something, there seems to be no easy way in Wix 3 to
dynamically set the value of a property without making a CustomAction.
The SetProperty doesn't seem to help since you can't do:
 <SetProperty Id="USER_DOMAIN_PROP" Value="DOMAINDEV" ...>
      <![CDATA[%ENVIRONMENT = "DEVELOPMENT"]]>
 </SetProperty>
 <SetProperty Id="USER_DOMAIN_PROP" Value="DOMAINPROD" ...>
      <![CDATA[%ENVIRONMENT = "PRODUCTION"]]>
 </SetProperty>


But replicating the Component XML containing the iss:Web* elements and
tweaking 10 times seems like a bad idea. 95% of the contents are the
same and some day someone will forget to update them all correctly.

Thoughts?

----- Ed



----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to