FWIW, while .NET has the System.Environment class available, I tend to still use the MSI provided OS Properties ( [ProgramFilesFolder] [ProgramFiles64Folder] ) for these types of resolution. It's a not reinvent the wheel kind of thing.
---------------------------------------- From: keith.doug...@statcan.gc.ca Sent: Wednesday, September 05, 2012 2:51 PM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Custom action question I have a 32 bit application whose installation package includes a CA written in C#. This works fine on 32 bit Vista and fails to work on x64 Windows 7. At first I caught that I had accidentally hardcoded to C:\program files\, but I have since written in a check to see whether or not we're on 32 or 64 and using the appropriate path accordingly. I use the following (obtained from CodePlex): private string GetProgramFiles() { if (IntPtr.Size == 8 || !String.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))) return System.Environment.GetEnvironmentVariable("ProgramFiles(x86)"); else return System.Environment.GetEnvironmentVariable("ProgramFiles"); } However, it seems that this does not work right. I still get the 32 bit value back when run in a CA. Is there some sort of gotcha about custom actions I should know about? I find it incredible that IntPtr.Size would change, but ... The identical code does return the right directory (ProgramFiles(x86)) in a standalone application. I will triple check that the right code is being built into the CA and the MSI, but ... Keith Douglas Statistics Canada | 170 Tunney's Pasture Driveway, Ottawa ON K1A 0T6 Statistique Canada | 170, promenade Tunney's Pasture, Ottawa ON K1A 0T6 keith.doug...@statcan.gc.ca Telephone | Téléphone 613-951-4405 Facsimile | Télécopieur 613-951-1966 Government of Canada | Gouvernement du Canada ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users