使用c#安装Msi文件

-1 c# asp.net windows-installer

我正在尝试使用 asp.net 应用程序插入 msi 文件。当我在管理员模式下运行 Visual Studio 时它工作正常但是当我在正常模式下运行它时它不起作用。我曾尝试以下代码:

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

任何机构都可以指导我如何在没有管理员的情况下安装它

Pan*_*are 5

您可以使用 msiexec.exe 来运行安装程序。这是示例代码。

        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();
Run Code Online (Sandbox Code Playgroud)