Create an object of class Installer. It has a Products property. It returns a list of installed product guides. To get the manufacturer and product name, we call Installer.get_ProductInfo, passing it the resulting guide and property name. Works. But to find a way to get the directory in which the product is actually installed, did not work.

  • And InstallLocation (ARPINSTALLLOCATION) - isn't that what you need? - stanislav
  • Is this a method of what? If this is an exported function, then what dll? What type of parameter is passed? <br> <br> installer.get_ProductInfo (productGuid, "InstallLocation") returns an empty string. - Modus
  • If your installer is yours, then you can add a Custom Action, which will set the TARGETDIR value in ARPINSTALLLOCATION during installation and the return value will not be empty. If not yours, then this method will not work, since most installers do not prescribe this property by default. - stanislav

2 answers 2

In general, it cannot be deterministic. The installer certainly knows where the program is installed, but I do not think that you can take it and ask. Naturally, the answer to the question “how does he know?” Is usually such - it is written in the registry. Therefore, if you know the path in the registry, then take it from there, if not - I would try using a spear method, that is, if Directory.Exists(@"c:\program files\x") then ... else if (Directory.Exists(@"c:\program files (x86)\x")... and so on.

    When installing the keys are placed in the registry. Look there should be. If not, start the key when installing.

    • The boss says so wrong. Such a solution will depend on the installer implementation, and if you use WindowsInstaller, he will figure out where to look for the necessary information. - Modus