MSI doesn't run from within C#

前端 未结 3 1291
南笙
南笙 2021-01-12 10:24

I am trying to run an MSI file from C# using the Proces.Start method. The MSI file is fine, because I can run that normally, but when I try to run the MSI file within some C

相关标签:
3条回答
  • 2021-01-12 10:28

    It is also possible to execute the .msi file directly with the associated application. This happens when you set UseShellExecute to true:

    Process.Start(new ProcessStartInfo() 
    { 
        FileName = @"c:\somepath\mySetup.msi", 
        UseShellExecute = true 
    });
    
    0 讨论(0)
  • 2021-01-12 10:38

    msi files cannot run on their own. If you double click on them, Windows will start

    msiexec /i PathToYour.msi

    Did you try to do that explicitly?

    Example: (Courtesy @Webleeuw)

    Process p = new Process();
    p.StartInfo.FileName = "msiexec";
    p.StartInfo.Arguments = "/i PathToYour.msi";
    p.Start();
    
    0 讨论(0)
  • 2021-01-12 10:40

    Addition to question poster's comment on Benjamin's answer:

    Process p = new Process();
    p.StartInfo.FileName = "msiexec";
    p.StartInfo.Arguments = "/i PathToYour.msi";
    p.Start();
    
    0 讨论(0)
提交回复
热议问题