I have an app where I'm downloading MariaDB in specific path and after that I run the installer but I would like to change the path where MariaDB will be installed, this is the code I'm working with
private void InstalarMariaDB()
{
try
{
Process proceso = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.WorkingDirectory = rutaDirectorio;
startInfo.Arguments = "/C msiexec /i MariaDB.msi /passive";
proceso.StartInfo = startInfo;
proceso.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I need to do this in the arguments line I guess
startInfo.Arguments = "/C msiexec /i MariaDB.msi /passive";
I tried this but didn't work because it says params are not valid for the list of msi installer Silent installation with target directory path as parameter
Arguments = "/s /v/qn /vINSTALLDIR=\"+targetDir+"\""
I hope you can help me, thank you
This is what I did to solve my issue based on the comments I read on here
private void InstalarMariaDB()
{
try
{
// MSI path
string rutaMSI = rutaDirectorio + "MariaDB.msi";
// Installation path
string rutaInstalacion = @"C:\Program Files (x86)\PudveBD\";
// Service name
string servicio = "PudveBD";
// Args
string argumentos = string.Format("/qn /i \"{0}\" INSTALLDIR=\"{1}\" ALLUSERS=1 PORT=6666 SERVICENAME=\"{2}\"", rutaMSI, rutaInstalacion, servicio);
Process proceso = new Process();
proceso.StartInfo.FileName = "msiexec.exe";
proceso.StartInfo.Arguments = argumentos;
proceso.StartInfo.Verb = "runas";
proceso.Start();
proceso.WaitForExit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}