When I'm trying to call this method from windows server 2003 SP2 Enterprise Edition KN x86:
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
I am getting the current directory rather than the program files directory, for example, my application is installed in this location: C:\Program Files\Company\ApplocationName\SomeApp.exe
When calling:
string x = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
x value will be: C:\Program Files\Company\ApplocationName
Is it a known issue? is there any ideas about this?
Copied from MSDN
"On an x86 system, passing the ProgramFilesX86 member to the Environment.GetFolderPath method returns String.Empty; use the ProgramFiles member instead. You can determine whether Windows is a 32-bit operating system by calling the Environment.Is64BitOperatingSystem property."
So you should use
string x = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);