The installer crashes on startup using Process.Start (), but works when double-clicked.

I have problems with System.Diagnostics.Process.Start().

When I run a third-party installer (MSI package wrapped in an executable), it installs without problems at startup by double-clicking exe or called from the command line.

However, when I run it from the application using Process.Start(), the setup program crashes with error code 5 = access denied. Logs say that he fails because he cannot restore some registry settings.

Does anyone know the difference (safely) between double clicking on exe and starting the process from the application? The user is managed by an administrator.

Code example:

var info = new ProcessStartInfo();
info.FileName = @"C:\MyFolder\setup.exe";
info.UseShellExecute = false; // I have tried both true and false here

Process p = Process.Start(info);
p.WaitForExit();

if (p.ExitCode != 0)
{
    // Do something...
}

UPDATE:

, . , - ...

, . , . , .

, . .

+3
2

, , ; , . - :

Process installer = new Process()
installer.StartInfo.FileName = @"C:\MyFolder\Setup.exe";
installer.StartInfo.Arguments = " /s /v\" /qn\"";
installer.Start()
installer.WaitForExit();

if ( installer.ExitCode != 0 )
{
   //do something
}

exe (/s) MSI (/v). /qn Windows , .

0

info.Verb = "runas"?

, / . ,

0

All Articles