简体   繁体   中英

Installing SQL Server and .NET Framework from a visual studio setup project

我必须做四件事安装.net framework 3.5,安装SQL Server 2005并在服务器上运行我的sql脚本并创建数据库并使用visual studio 2005/2008安装我的应用程序如何在单个安装项目中执行

Use NSIS instead of the Visual Studio installer project:

http://nsis.sourceforge.net/Main_Page

It's much more powerful, but still pretty straightforward to use. Also there's lots of sample code for common tasks like installing .NET or SQL Server.

您无法从Visual Studio安装项目安装SQL Server。

You'll probably have to write an installer yourself or get an installer that you can attach other installers to it. Not sure why you would want to install sqlserver on a client's machine. Why not go with SQLLite or something that can be installed easily and have your database deployed without running scripts.

The framework can't be installed from within an MSI setup project. you can specify that it is a prerequisite but can only hope that the use will go through with the installation. If you are running a simple application you might get away with embedding the framework basic files in to your installation package.

Then comes SQL2005. If you can settle with SQL2005 express then the proper DLLs will be added to your project and no installation needs to be done. If you do need a standard edition then you can execute the SQL installation with predefined flags.

Creating a database is a little more tricky as the user should specify the database location and have the SQL server have privileges on that folder. I would strongly recommend NOT to create the database & run the scripts in the setup project but do it as a wizard the first time the program is executed.

The more you add up to the setup project the harder it will be to roll-back everything if something goes wrong in the installation.

Gilad.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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