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# code I receive the following error.
"This installation package could not be opened. Verify that the package exists, and that you can access it, or contact the application vendor to verify that this is a valid windows installer package"
Below is the code that I am using to run the MSI file...
Process p = Process.StartApplication.StartupPath "/Packages/Name.msi");
p.WaitForExit();
How can I fix this problem?
OK, I got it now. I just changed it to run the setup.exe file that is generated with the MSI file, instead of the running the MSI file...
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With