I'm attempting to detect the right cpu architecture for installing either a x86 msi or x64 msi file.
If I'm right, for the msi I need the os cpu architecture
I'm not totally sure if my way is right because I can't test it. What do you think?
private static string GetOSArchitecture()
{
string arch = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
string archWOW = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432");
if(archWOW != null && archWOW != "" && archWOW.Contains("64"))
return "x64";
if(arch.Contains("86"))
return "x86";
if (arch.Contains("64"))
return "x64";
return "";
}