• 0

Get Install Directory from MSI GUID


Question

Hi.

So I have a project that installs with an MSI, and I need to be able to get it's install directory later on from somewhere else.

This works:

			int a = 512;
			StringBuilder sb2 = new StringBuilder(a);
			MsiGetProductInfo("{2E2C2AD2-6F72-44D4-925B-4F6130A241D8}", "InstallSource", sb2, ref a);
			Console.Write(sb2.ToString());
			Console.ReadLine();

and returns the path to the MSI I used to install it. But when I sub in InstallLocation, I just get back nothing as a result. What am I doing wrong?

I found the place in the registry where all this data is coming from: hklm\software\microsoft\windows\currentversion\installer\userdata\s-1-5-18\products\myguid\

The InstallLocation is blank. That doesn't make any sense, because I just installed it and It obviously installed somewhere (The default location)

Or does default location just mean a blank entry for InstallLocation?

Link to comment
https://www.neowin.net/forum/topic/569064-get-install-directory-from-msi-guid/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Found this:

InstallLocation in registry uninstall information is not being written when using VS2005 Deployment Project:

  Quote
To Set a value in the registry key "HKLM\Software\Windows\CurrentVersion\Uninstall\{ProductCode}\InstallLocation"

You need to set ARPINSTALLLOCATION Property through a custom action in your msi.

The custom action will set the ARPINSTALLLOCATION to the TargetDir

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.