Link to home
Start Free TrialLog in
Avatar of K-9
K-9

asked on

VS.Net Setup Project - 32 and 64 bit

I created a vb.net program, which has a 32 and 64 bit .dll file.  So, I created a setup project for each platform.  However right now the user needs to determine which platform they are running and must run the correct install.

How can I automatically determine (through code, under the setup deployment) which platform the user is running and then run the correct install program?
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

there are number of ways to detect that, here's one:
if the following registry is exists than it is 64bit, otherwise it's 32bit.

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

so in your vb.net code use the following:

Dim is64bit As Boolean = Registry.LocalMachine.OpenSubKey("SOFTWARE\Wow6432Node") IsNot Nothing

another way is using WMI:

Dim mso As New ManagementObjectSearcher("SELECT *FROM Win32_OperatingSystem")
Dim qc As ManagementObjectCollection = mso.[Get]()
For Each mo As var In qc
      Dim ostype As String = mo("OSArchitecture").ToString()
Next

the value of ostype is: "64-bit" or "32-bit"
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if u need another alternative let me know...
Avatar of K-9
K-9

ASKER

Thanks!