Solved

VS.Net Setup Project - 32 and 64 bit

Posted on 2010-08-23
5
401 Views
Last Modified: 2012-05-10
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?
0
Comment
Question by:K-9
  • 4
5 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 33500351
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

0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33500389
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"
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 33500436
another way is check the environment variable:

Dim val As String = Environment.GetEnvironmentVariable("ProgramFiles(x86)")

if val is not nothing than the OS type is 64bit, otherwise 32bit.
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33500441
if u need another alternative let me know...
0
 

Author Closing Comment

by:K-9
ID: 33859600
Thanks!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Modal Popup Extender control 1 53
VB.net Open video relating to control 2 31
Consume a webservice via VB in Visual Studio 2015 3 22
VB.Net Data Class 1 23
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question