Wixsharp: How to get the installer (msi file) path

Created on 28 May 2020  路  4Comments  路  Source: oleg-shilo/wixsharp

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"?

question

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).

All 4 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ayman-eltemsahi picture ayman-eltemsahi  路  4Comments

ltemimi picture ltemimi  路  5Comments

meytes picture meytes  路  5Comments

mgkeeley picture mgkeeley  路  5Comments

ju2pom picture ju2pom  路  5Comments