I have written a C# application that uses a SQL Server database. The intended users of this program will be running SQL Server 2008 R2. I have created a setup program (deployment project in visual studio) that installs my program but I would also like it to install the database. How do I go about accomplishing that?
相关问题
- How does the setup bootstrapper detect if prerequi
- Sorting 3 numbers without branching [closed]
- sql execution latency when assign to a variable
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
You could write a custom install action. Take a look at the following article.
It is better that you let the users install SQL Server 2008 themselves. This gives better flexibility with regards to versions of the database server, and also gives them the possibility to install it on a different machine if they need it. SQL Setup lately also has gotten quite complex and not very straightforward. If you need an embedded SQL Server then you can use SQL Server Compact instead.
Within your application you can create the necessary DB on SQL Server 2005+ using the following code. Keep in mind it requires SA privileges on the SQL server. You need to replace %db_name% with the actual name of the database.
You dont. Well, what you normally do is that your setup msi file has a bootstrapper, a .exe program that triggers install of the MSI. This one will ALSO check prerequisites and trigger installs of those if needed and available.
Check http://wix.mindcapers.com/wiki/Bootstrapper for a more detaoled explanation and some examples of what is available to you.
simply you have to add deployment project in your developed project. say named it proj_deploy then right click on this project (proj_deploy) and choose properties being in VS 2008 / 2010 then go to prerequisites and select which items you want to be installed on client machine when someone install your developed project.
prerequisites are bootstraps by which you can install third party tools and etc.
If it is a client/server application then the SQL Server most likely will already exist and won't be on the same pc as your application.
If it is a single-user database application, I would recommend using SQL Server Compact. Then the "installation" consists of just copying some dlls.