To the best of my knowledge....

As long as your installer is tagged correctly as a 32bit installer by
setting the Platform attribute of the Package node  to "x86" like this:

<Package Id="*" InstallerVersion="200" Compressed="yes" Languages="1033"
Platform="x86" InstallPrivileges="elevated" InstallScope="perMachine"  />


[PROGRAMFILES] will resolve to "Program Files (x86)" on 64-bit windows, and
"Program Files" on 32bit windows.... This means you can use the value of the
[PROGRAMFILES] property when you write to your web.config file.

I know that xmlfile and xmlconfig has already been not recommended in this
thread, but maybe this wix snippet will show you the light...

<util:XmlFile Id="MyMagicId " Action="setValue"
ElementPath="//root/node1/node2" File="[MyDirectory]settings.xml"
Value="[PROGRAMFILES]" />

Using that... (assuming "C" is where windows is installed)
On 32bit windows.... [PROGRAMFILES] will equal  "C:\Program Files"
On 64bit windows.... [PROGRAMFILES] will equal  "C:\Program Files (x86)"

This works for me correctly on 32 & 64bit windows.

You don't need to know the exact string value of the [PROGRAMFILES]
property, you just need to know that it will resolve to the correct "real
folder on disk", and always use the property when referencing it.

Does that help?


-----Original Message-----
From: Erica Chang (PROJECT) [mailto:eri...@microsoft.com] 
Sent: Monday, July 13, 2009 3:51 PM
To: 'General discussion for Windows Installer XML toolset.'
Subject: Re: [WiX-users] Updating web.config field value depending on if
machine's 64bit or 32bit

What we are doing is installing sample sites that needs the location of the
install as environment variable in web.config to access a file in the
appsettings section.

However, because our SDK only builds in 32bit, the web.config needs a file
location but I need to detect whether to use %programfiles% or
%programfiles(x86)% in web.config and I was hoping that during install, we
can write some custom action to substitute appropriately.  Will
ProgramFilesFolder work appropriately?

Thanks for all the responses so far.

Thanks,
Erica

-----Original Message-----
From: Mike Carlson (DEV DIV) [mailto:mica...@microsoft.com]
Sent: Monday, July 13, 2009 12:06 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Updating web.config field value depending on if
machine's 64bit or 32bit

Keep in mind it's better to avoid XmlFile / XmlConfig and just rely on
standard IIS custom action functionality, if possible. I don't know enough
about your particular scenario to know if it's possible in this case, but if
you can throw a [ProgramFilesFolder] into your IIS authoring somewhere
instead of relying on Xml modification of web.config, you'll be better off.

I know in some cases modifying web.config with XmlFile / XmlConfig Vista
will result in slightly unexpected behavior, because the IIS custom action
doesn't flush data to disk in 3.0 (so XmlFile / XmlConfig would be operating
on the XML file before it was modified by the IIS custom action, even though
the IIS custom action was earlier in the sequence). A flush operation was
added to the custom action to fix this scenario in 3.5, but 3.5 is still
early on and it's hard to recommend it at this point in time.

Thanks,
Mike Carlson

-----Original Message-----
From: Don Benson [mailto:dbenso...@gmail.com]
Sent: Monday, July 13, 2009 11:53 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Updating web.config field value depending on if
machine's 64bit or 32bit

Windows Installer automatically handles translating the ProgramFilesFolder
property for 32-bit vs. 64-bit platforms. Are you using an XMLFile element
to set the web.config value? Use the [ProgramFilesFolder] property within
the XMLFile element, and you should get what you want.

- Don Benson -
Tribute Inc.

On Mon, Jul 13, 2009 at 1:59 PM, Erica Chang (PROJECT) <eri...@microsoft.com
> wrote:

> Hi,
> I have a field in web.config that needs environment variable of
> %ProgramFiles% or %ProgramFiles(x86)% depending on if the machine
installing
> is 64 bit or 32 bit.
>
> Is there a way to substitute the values during install time by detecting
> this and setting the appropriate values?
>
> Thanks so much in advance.
>
> Regards,
> Erica
>
>
----------------------------------------------------------------------------
--
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full
prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
----------------------------------------------------------------------------
--
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize

details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to