0

I am using Ant to deploy and install some Windows Installer packages (MSI) in different machines.

I would like to have Ant check if the msi package is already installed (using the ProductCode) in the machine, before trying to install it.

Is there a way to add a condition in Ant to check if the msi product is already installed?

I've found that to query Windows Installer products you can use the API: link and another link

I think my only option is to build a .exe that receives a ProductCode and uses the API to see if the msi is installed. Then somehow it tells Ant if the Product is installed or not.

Community
  • 1
  • 1
Herno
  • 1,497
  • 2
  • 21
  • 40

1 Answers1

0

I don't really have much experience with Ant (NAnt and MSBuild; yes) but from what I can see you can write an "external task" and call it from your build script. I assume that external task is written using Java. I'm also assuming that somehow in Java (JNI?) that it's possible to call Win32 or COM API's so I'd think it would be possible to create a task that takes a ProductCode or UpgradeCode as an argument and returns back information about whether something is installed or not.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100