简体   繁体   English

以无提示模式安装SQL Server Express 2008以及C#应用程序

[英]Install SQL Server Express 2008 in Silent mode along with a C# application

I need to install SQL Server 2008 Express along with my C# application, but in a silent mode. 我需要安装SQL Server 2008 Express和我的C#应用​​程序,但是在静默模式下。 As I want it to be easy for the user (who is a very basic user), I guess I will need a configuration file in order to specify all the parameters that I want it to be installed with. 因为我希望用户(他是一个非常基本的用户)很容易,我想我需要一个配置文件来指定我希望它安装的所有参数。

Can this configuration file be packaged with Visual Studio 2008 so everything is generated, or should I just create the config file, put it into the CD and when SQL Server is installing, specify the config file to be installed with? 这个配置文件是否可以与Visual Studio 2008一起打包以便生成所有内容,或者我应该只创建配置文件,将其放入CD中并在安装SQL Server时指定要安装的配置文件?

Cheers everybody in advance! 提前为大家喝彩!

It can be done. 可以办到。 You need to make your EXE bootstrapper launch the SQL Server prerequisite with a custom command line which contains a configuration file or the appropriate command line parameters for a silent install. 您需要使EXE引导程序使用自定义命令行启动SQL Server先决条件,该命令行包含配置文件或静默安装的相应命令行参数。

Visual Studio setup projects do not support custom prerequisite creation. Visual Studio安装项目不支持自定义先决条件创建。 However, it can be done by manually generating the required manifests. 但是,可以通过手动生成所需的清单来完成。

You can find the manifests structure here: http://msdn.microsoft.com/en-us/library/ms229223(VS.80).aspx 你可以在这里找到清单结构: http//msdn.microsoft.com/en-us/library/ms229223(VS.80).aspx

These manifests can be generated automatically with the Bootstrapper Manifest Generator tool. 使用Bootstrapper Manifest Generator工具可以自动生成这些清单。

After generating the package manifests, you can add all these files (including the package) in a separate folder in the Visual Studio prerequisites folder, for example: 生成包清单后,您可以将所有这些文件(包括包)添加到Visual Studio先决条件文件夹中的单独文件夹中,例如:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages

You can then select the custom prerequisite in your setup project Properties page. 然后,您可以在安装项目“属性”页面中选择自定义先决条件。

If you need to install quiet silence from c# the code is this: Care to take away all spaces in the string argumentos, I don´t know why but they go with the string and doesn´t work properly 如果你需要从c#安装安静的静音,代码就是这样:小心拿掉字符串中的所有空格,我不知道为什么但是它们跟字符串一起使用并且不能正常工作

        String sqlfile = @"\Msi\SQLEXPR_x64_ESN.exe"; 
        //or wathever sql inst file you have
        myProcess.StartInfo.FileName = sqlfile;            
        String argumentos = @"/qs /Action=Install  /Features=SQL,Tools /IACCEPTSQLSERVERLICENSETERMS=""True"" /INSTANCENAME=""SQLExpress_AV"" /SQLSYSADMINACCOUNTS=""Builtin\Administrators"" /SQLSVCACCOUNT=""NT AUTHORITY\SYSTEM"" ";

        //MessageBox.Show(argumentos);
        myProcess.StartInfo.Arguments = argumentos;
        myProcess.StartInfo.UseShellExecute = false;
        myProcess.Start();

I haven't tried this personally but there are short clear instructions here 我没有亲自试过,但也有短明确的指示, 在这里

http://sqlbeyond.blogspot.com/2011/07/sql-server-express-2008-r2-unattended.html http://sqlbeyond.blogspot.com/2011/07/sql-server-express-2008-r2-unattended.html

Basically, extract your files to a folder and invoke installation as follows: 基本上,将文件解压缩到一个文件夹并按如下方式调用安装:

SETUP.exe /ACTION=Install /INSTANCENAME=SQLExpress /FEATURES=SQLENGINE /QS /IACCEPTSQLSERVERLICENSETERMS=true /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /BROWSERSVCSTARTUPTYPE=Disabled /ADDCURRENTUSERASSQLADMIN=true /TCPENABLED=1 /HIDECONSOLE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM