When I debug the msi installer created by Wixsharp, the method System.IO.Directory.GetCurrentDirectory() returns this result "C:\Windows\SysWOW64".
Is there a way for me get the current directory of the installer? (.msi file)?
For example, if the Setup.msi in under C:\temp folder, is there a way for me to get the directory "C:\temp"?
There is an MSI property called CURRENTDIRECTORY. You can check its value in the .msi.log file (in your %temp% folder by default).
It works. Thank you!
There is a direct deterministic way to get this info:
C#
project.AfterInstall += project_AfterInstall;
. . .
static void project_AfterInstall(SetupEventArgs e)
{
Debug.WriteLine(e.MsiFile);
. . .
good question, im use MsiRuntime.Session["CURRENTDIRECTORY"] in managed UI.
but after elevation
var startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.WorkingDirectory = msiDir;
startInfo.FileName = "msiexec.exe";
startInfo.Arguments = "/i \"" + e.MsiFile + "\"";
startInfo.Verb = "runas";
it return system32 path. how to get the correct path from where it was launched?
Most helpful comment
There is an MSI property called
CURRENTDIRECTORY. You can check its value in the .msi.log file (in your %temp% folder by default).