简体   繁体   中英

Installing MSI through windows service

I have a strange problem,

I have a WPF application . I have created a windows installer for this and installation will create application shortcut in user's start menu. I'm installing this MSI through windows service . Installation works fine through windows service but it doesnt create shortcut in start menu also i dont see this application under Programs and Features. But if i manually install this everything works fine. Any clue why this is happening ?

Code to execute MSI

 Process installProcess = new Process();
                //Assign required properties
                installProcess.StartInfo.FileName = MSIEXEC;
                installProcess.StartInfo.RedirectStandardError = true;
                installProcess.StartInfo.UseShellExecute = false;

                LogManager.Write("Process object is created");

                //Create new StringBuilder instance
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(SYMBOL_SLASH);
                stringBuilder.Append(SYMBOL_INSTALL);
                stringBuilder.Append(installerPath);
                stringBuilder.Append(SYMBOL_QN);

                LogManager.Write("StringBuilder is created: " + stringBuilder.ToString());

                installProcess.StartInfo.Arguments = stringBuilder.ToString();
                installProcess.Start();

InstallAllUsers property in for MSI was set to false . My windows service was running under Local System account and my machine was logged in with windows authentication under administrator account . So when the installation happened it was assumed that MSI is installed by the user other than who has logged into the machine with windows authentication so it didnt not show up in the start menu and under Programs and Features.

It was not necessary for me to keep the InstallAllUsers to false so simply i made it true which solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM