通过应用程序安装程序静默安装SQL Server [英] Install SQL Server silently through from application setup

查看:104
本文介绍了通过应用程序安装程序静默安装SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



作为安装我的应用程序(WPF应用程序)的一部分,需要安装SQL Server以及先决条件.因此,当用户选择安装SQL Server的选项时,在应用程序安装过程中,需要使用安装程序随附的configuration.ini文件进行静默安装.

因此,我要做的是通过具有执行SQL服务器命令的代码准备一个名为"InstallSQL.bat"的批处理文件.

现在,当用户选择从安装代码中安装SQL Server时,将执行批处理文件.代码如下

Hi,

As part of installing my application (WPF application), need to install SQL Server as well as a prerequisite. So when the user choose the option to install SQL Server, during the course of application installation, it need to get installed silently using the configuration.ini file provided with the setup.

So what i did was prepare a batch file called "InstallSQL.bat" through code which has the command to execute SQL server.

Now when the user choose to install SQL server, from installation code, the batch file is to be executed. The code is as below

            int ExitCode;
            ProcessStartInfo ProcessInfo;
            Process process;            
            
            ProcessInfo = new ProcessStartInfo(batchFilePath);
            ProcessInfo.CreateNoWindow = true;
            ProcessInfo.UseShellExecute = false;

            ProcessInfo.WorkingDirectory =                    Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            // *** Redirect the output ***
            ProcessInfo.RedirectStandardError = true;
            ProcessInfo.RedirectStandardOutput = true;
            process = Process.Start(ProcessInfo);
process.WaitForExit();
MessageBox.Show("ExitCode: " + process.ExitCode);



执行安装程序时,在安装SQL Server时,将提取SQL Server安装程序文件,并打开一个控制台窗口,指示安装正在进行中.
问题是,在此控制台窗口中经过一段时间后,出现一条消息,指出由于stackoverflowexception而终止了进程".有人可以帮我一个安静地安装SQL Server的替代方法(无需用户交互).

谢谢
Nishitha



When execute the setup, at the point of SQL Server installation, the SQL Server setup files are extracted and a console window opens up indicating installation is in progress.
The issue is, after some time in this console window a message appears saying "Process is terminated due to stackoverflowexception". Can someone please help me with an alternative for installing SQL Server silently (without user interaction).

Thanks
Nishitha

推荐答案

使用SqLite.您可以将其与应用程序一起移植.
Use SqLite. You can port it along with your application.


这篇关于通过应用程序安装程序静默安装SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆