kaycee
kaycee

Reputation: 911

How to launch an executable specified in a custom action only when it is not already installer on the user computer?

I'm building a setup executable using Visual Studio 2015 Setup Project template.

I added an external executable in the file system of my package that the user needs to install to be able to run my program. Then, I added this package as a custom action on Commit.

I want my install package to recognize if this external executable is already installed on the user computer by looking at the registry of looking at a certain folder structure on the computer (the method to check is not defined yet).

How can I set up this kind of check for the custom actions ? I've seen that there is a Condition property when clicking on the .EXE in the Custom Actions window, but all I can find about this property is that, which does not really answers my problem.

Upvotes: 0

Views: 315

Answers (1)

PhilDW
PhilDW

Reputation: 20780

VS setups offer a registry search, and that search will set a property name that you define (in uppercase). If the registry entry exists, meaning that you don't need to run the program, then you give the custom action a condition of NOT FOUNDREGISTRY assuming FOUNDREGISTRY is the name of the property.

Having said that, if that program is a redistributable that installs something then:

  1. They are typically smart enough to figure out if they need to do anything or not, and that includes seeing if what's already installed is an older version, so they should run anyway because it's a newer version. So it may be best to just run it anyway.

  2. If the executable wraps a MSI-based setup then it will fail because you can't install an MSI-based setup with a custom action in a VS MSI setup.

Upvotes: 1

Related Questions