1

I'm trying to access the TargetPlatform property value (which you can set in a Deployment project) from the condition within a "Launch Condition".

Basically I'm trying to tell the application not to install itself as a 32bit app if a 64bit version of Office is installed on that computer. Therefore I need to somehow get the application's bitness and put it in a launch condition.

I can get the bitness of Office from the registry, but I don't know how to access the TargetPlatform from the installer.

Thanks!

Alex
  • 7,432
  • 20
  • 75
  • 118
  • Are you getting the registry setting for Office in custom code in a `ProjectInstaller` class? Can't you check the current platform there and abort the installation if your condition is met? – batwad Nov 17 '10 at 17:00

3 Answers3

2

Here are two link:

From the above link you can deduce that you can't target both platforms from a MSI installer. You will need to have two installers. Depending on how the installer is built, x86 or x64, will depend the way the installer interprets some constants that tell where to isntall the files - Program Files, or Program Files (x86).

You can't change the TargetPlatform of the installer at runtime.

What you can do maybe is to have two installers packed into a third one and based on the Office version installed that you say you can obtain run either sub-installer x86 or sub-installer x64, that will actually install the application files.

If MSI installer is not the outmost requirement I would go for NSIS. If not at least package the to MSI installers into an NSIS one. It is incredibly easy. NSIS is way cooler than MSI, talking from experience.

Liviu Mandras
  • 6,540
  • 2
  • 41
  • 65
  • Hey Liviu, do you have a link to how I can combine the 2 installers into a third one? – Alex Nov 12 '10 at 13:49
  • It's actually a very complicated discussion. Officially MSI's can only marked x86 or x64 but there are techniques to create "hybrid" installers that can target both in some limited ways. Making it more complicated is when considering managed vs unmanaged code and creating addins for applications such as office which can be 32bit or 64bit... the question of "Am I a 32bit app or a 64bit app?" isn't very easy to answer or plan for. – Christopher Painter Nov 12 '10 at 14:15
  • @Andrei After lookign aroudn it seems that nested MSI pacakges incredibly hard to accomlish. So I would recommend NSIS. – Liviu Mandras Nov 12 '10 at 14:31
  • I nest MSI package installations all the time. It's just a couple clicks with InstallShield to set it up. – Christopher Painter Nov 13 '10 at 01:21
  • @Christopher Well InstallShield is a different kind of cat, so to speak. But nest 2 MSI inside another MSI not using InstallShield. For IS you will need a very expensive license also. – Liviu Mandras Nov 13 '10 at 07:33
  • InstallShield is a tool that authors Windows Installer databases. It's not really different. InstallShield Professional currently can be had for as low as $1,500. You just said eariler that nesting MSI packages is incredibly hard to accomplish. Think about your bill rate and how many hours $1,500 is. It doesn't seem very expensive to me. – Christopher Painter Nov 13 '10 at 13:18
1

I've read this question a few times now and I'm not 100% certain I understand what you are trying to do. Do you have a 32bit application and you only want to install if they have 32bit Office (2010 I assume) installed? Do you also have a 64bit version that you want to install if 64bit office is installed?

I'm not sure why you need to care about the TargetPlatform property because if you know that 64bit Office is installed you must by definition be a 64bit OS. If 32bit Office is installed you could possibly be a 64bit OS but does it really matter? You said you cared about the bitness of Office not Windows.

I would think, from what I've read, that if you have an AppSearch that pulls the bitness into a property that you could just use a LaunchCondition that uses that property along with "or Installed" ( to handle being able to uninstall your application if Office was uninstalled first ) and be just fine.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Chris, I mean: if the user has 64 bit Outlook and he downloaded the 32 bit version of my app, I want to stop the installation immediately. – Alex Nov 12 '10 at 13:50
  • Then I don't think you need TargetPlatform at all. You said you have a way of detecting 64bit Office. Can I assume you are using AppSearch? What's the name of your property and what's the value when Office isn't installed, when 32bit Office is installed and when 64bit Office is installed? I think that's all you need to focus on to write your LaunchCondition. – Christopher Painter Nov 12 '10 at 14:05
  • You mention that you are using Windows Installer but I have no way to know if you are using InstallShield, Wise, WiX, Visual Studio Deployment Projects or other. Here's a good blog article for you to read http://blog.deploymentengineering.com/2010/10/vsto-4-2010-lessons-learned.html http://blog.deploymentengineering.com/2010/09/office-2010-bitness-pain.html – Christopher Painter Nov 12 '10 at 14:12
  • I'm using Visual Studio Deployment Projects. The current way to search for Outlook bitness is to look in the registry: http://stackoverflow.com/questions/2203980/detect-whether-office-2010-is-32bit-or-64bit-via-the-registry – Alex Nov 16 '10 at 11:46
1

Add a custom action before the installation starts to perform the check. Use an Installer class to perform the custom action. You could use the OnBeforeInstall event to read the registry key and check the bitness as appropriate. Throwing an exception will cause the installation to abort, but there may be a cleaner way to do this.

batwad
  • 3,588
  • 1
  • 24
  • 38