Search code examples
c#asp.netwindows-installer

Install Msi file using c#


I am trying to insert msi file using asp.net application. when i run visual studio in administrators mode it is working fine but when i run it in normal mode it is not working. I had tried following code:

string installerFilePath;
installerFilePath = @"D:\ActivexPractice\test\test\NewFolder1\setup.msi";
System.Diagnostics.Process installerProcess = System.Diagnostics.Process.Start(installerFilePath, "/q");

can any body guide me on this how to install it without administrators right


Solution

  • You can use msiexec.exe to run installer. Here is sample code.

            Process installerProcess = new Process();
            ProcessStartInfo processInfo = new ProcessStartInfo();
            processInfo.Arguments = @"/i  D:\ActivexPractice\test\test\NewFolder1\setup.msi  /q";
            processInfo.FileName = "msiexec";
            installerProcess.StartInfo = processInfo;
            installerProcess.Start();
            installerProcess.WaitForExit();