Right now, I'm calling the following line
System.Configuration.Configuration cnf = ConfigurationManager.OpenMachineConfiguration();
the result is the following cnf.FilePath == C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
I get the following result on a 32bit 2003 server and a 64 bit 2008 R2 server. Ideally I would like to return the 64bit folder when installed on a 64bit server.
aka - C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
Is there a way to get the 64 bit version without resorting to doing ConfigurationFileMaps - such as Configuration examples from Msdn
Update for comment
Based on the above answers, I created a Visual Studio Installer. It would appear that the installer runs as a 32-bit process by default. As such any .NET code you have running as the custom Installer action would be running as 32-bit which is why you are only seeing the 32-bit Machine.Config and not the 64-bit version. This MSDN Article explains how to create the installer as a 64-bit installer. A 32-bit installer can install 64-bit items however, a 64-bit installer can only install on a 64-bit OS. You may need to have two installers created (32-bit and 64-bit) and then have the users use the appropriate version if you want to keep it simple. After I made the change to the TargetPlatform for the installer it showed up in TaskManager as a 64-bit process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With