HOw to get the directory from where the msi is being executed?

Jun 22, 2016 at 2:25 PM

I guess my question is clear enough. Could some one help me with this.

Jun 24, 2016 at 4:14 AM
It's rather difficult.

WiX session object has the member that is supposed to give the assess to the file name:
var msiFile = e.Session.Database.FilePath;
But unfortunately because of WiX limitation or MSI bug the property is always empty. Meaning that if you indeed need to know the path you will have to do ir a hard way. Traverse up the parent process until find msiexec.exe and then discover the command line parameters containing the full path to your msi.
Jun 27, 2016 at 12:54 PM
You can try this
Jun 28, 2016 at 6:50 AM
Excellent. Thank you for sharing. SetupEventArgs from the start had a dedicated property for the msi file location. Though it was disconnected as Session.Database.FilePath was broken. I am happy to use Session["OriginalDatabase"] as a work around and the next release (the code is already committed) SetupEventArgs will be properly initialized:
static void project_Load(SetupEventArgs e)
    var msi = e.MsiFile;