Search code examples
visual-studio-codewixwindows-installer

How to detect if VS Code is already installed on Windows Client machine or not


I'm building a WIX Toolset based installer for my app.

To use my app, the user's Windows machine needs to have VS code. I am including VS code exe file in my package and I would like to add a conditional statement to decide whether I need to initiate VS code exe installation or not.

From the command line, if I type code --version, it seems that it returns VS code version information if the PC already has VS code app. I am trying to figure out the way to utilize this information to create a conditional statement...

Appreciate any insights and suggestions!

Thank you very much!!


Solution

  • Typically application detection is done using the registry. If you're doing this detection in an MSI you'll want to use RegLocator to set a property. If you're installing using a bundle you'll want to use RegistrySearch.

    What you'll search for in the registry is going to take some sleuthing for where to search and the values. Just a quick search found this site.