Solved

VS.Net Setup Project - 32 and 64 bit

Posted on 2010-08-23
5
398 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now