在 msi 安装程序中安装 MSOLEDBSQL 驱动程序
我的产品有一个 MSI 安装程序,需要 MSOLEDBSQL 驱动程序才能运行。我试图将驱动程序安装作为主安装程序的一部分,而不是作为先决条件(这是迄今为止的处理方式)。
以下是我编写的用于在主安装程序的代码中安装驱动程序的代码:
public static void InstallSQLDriver()
{
Logger.LogInfo("Installing the MSOLEDBSQL Driver");
ProcessStartInfo startInfo = new ProcessStartInfo("msiexec.exe", $"/i msoledbsql.msi /quiet IAcceptMSOLEDBSQLLicenseTerms=YES /qn ACCEPTEULA=1 /norestart ALLUSERS=1");
startInfo.Verb = "runas";
startInfo.UseShellExecute = true;
try
{
Process proc = Process.Start(startInfo);
proc.WaitForExit();
if (proc.ExitCode == 0)
{
Logger.LogInfo("MSOLEDBSQL Driver Installation successful");
}
else
{
Logger.LogInfo("MSOLEDBSQL Driver Installation failed. Process ended with code : " + proc.ExitCode);
}
}
catch (Exception ex)
{
Logger.LogInfo("MSOLEDBSQL Driver Installation failed with error : " + ex.Message);
}
}
但是,运行此代码会在日志中出现错误,退出代码为 1618,并显示:另一个安装已在进行中。在继续此安装之前完成该安装。
我知道我们不能同时运行 2 个 MSI,但是我们可以进行任何更改来完成我想要做的事情吗?有谁知道如何在启动主应用程序的安装程序之前避免使用先决条件安装?
I have an MSI installer for my product which needs the MSOLEDBSQL driver to run. I am trying to include the driver installation as part of the main installer and not as a pre-requisite (which is how it was being handled till now).
Following is the code I have written to install the driver within my main installer's code :
public static void InstallSQLDriver()
{
Logger.LogInfo("Installing the MSOLEDBSQL Driver");
ProcessStartInfo startInfo = new ProcessStartInfo("msiexec.exe", quot;/i msoledbsql.msi /quiet IAcceptMSOLEDBSQLLicenseTerms=YES /qn ACCEPTEULA=1 /norestart ALLUSERS=1");
startInfo.Verb = "runas";
startInfo.UseShellExecute = true;
try
{
Process proc = Process.Start(startInfo);
proc.WaitForExit();
if (proc.ExitCode == 0)
{
Logger.LogInfo("MSOLEDBSQL Driver Installation successful");
}
else
{
Logger.LogInfo("MSOLEDBSQL Driver Installation failed. Process ended with code : " + proc.ExitCode);
}
}
catch (Exception ex)
{
Logger.LogInfo("MSOLEDBSQL Driver Installation failed with error : " + ex.Message);
}
}
However, running this gets me an error with exit code 1618 in my log saying : Another installation is already in progress. Complete that installation before proceeding with this install.
I know that we can't run 2 MSIs concurrently, but are there any changes we can make to do what I am trying to do. Does anyone know how to avoid using a pre-requisite installation before I can start my main application's installer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以在
InstallExecuteSequence
中的InstallValidate
和InstallInitialize
之间或在InstallFinalize
之后执行此操作(添加自定义操作)(也在InstallExecuteSequence
中)I think you can do it (add a Custom Action) between
InstallValidate
andInstallInitialize
inInstallExecuteSequence
or afterInstallFinalize
(also inInstallExecuteSequence
)