I want to install vsto addin based on the excel version (32 bit or 64 bit). I am planning to bundle both 32bit and 64 bit msis and install one by determining the excel versi
You can't reliably detect it from registry (direct call). Better is to create Custom installer module in C# or VB.net, fetch ProductCode of application. From product code, you can get the Bitness.
Product code is also fetched from registry, but let Office application handle it.
Private IsExcel32Bit As Boolean = False
Private IsExcel64Bit As Boolean = False
Private ReadOnly STR_prdCodeDelimeter As Char = CChar("-")
Private Sub GetExcelBitness(ByVal exApp As Microsoft.Office.Interop.Excel.Application)
Dim prdCode As String = exApp.ProductCode
If Not String.IsNullOrEmpty(prdCode) AndAlso CInt(prdCode.Split(STR_prdCodeDelimeter)(3)(0).ToString) = 0 Then
IsExcel32Bit = True
ElseIf Not String.IsNullOrEmpty(prdCode) AndAlso CInt(prdCode.Split(STR_prdCodeDelimeter)(3)(0).ToString) = 1 Then
IsExcel64Bit = True
End If
End Sub
Btw keeping both installer separately is going to help you in future. Sometimes product code might be null or wrong if MS Office is not installed properly.