0

I am new to Visual Studio 2010, so please bear with me. Back in the days of using VB6 combined with an Access database, all I had to do was to use the Package & Deployment wizard and include the database file in the setup. Then all the client had to do was run one setup file and the application would magically run right away (the database would be placed in the App Path).

Is there some way to create a setup file in VS 2010 which will also install SQL Server Express automatically, attach the database along with the application itself?

This is meant for people who do not have SQL server installed and they should be able to start using the app by running one single setup.

Thanks!

Curtis
  • 101,612
  • 66
  • 270
  • 352
Osprey
  • 1,523
  • 8
  • 27
  • 44

2 Answers2

3

Yes, your setup based on Windows Installer and built with Visual Studio itself can deploy everything you need. Read this article on MSDN for more details (maybe you won't need ClickOnce but it contains a lot of links).

I guess you need some clarification about your options (I assume you want to use a Microsoft solution because you talked about SQLExpress).

  • Microsoft SQL Server: fully featured database engine. It costs (a lot) and deployment isn't easy as we would.
  • Microsoft SQL Server Express: free edition (with some limits) of the big brother. Same installation issues. Perfect for medium desktop or web applications.
  • Microsoft LocalDB: single or multiple file, single user, support for stored procedures and advanced data types as in higher versions, easy to deploy and (optionally) per-user execution. Perfect for small/medium desktop applications and developing (with some preconditions with web applications too).
  • Microsoft SQL Server Compact 4.0: single file, single user, small, in-process, very easy to deploy. Perfect for small single user applications or used as local data storage (VS2k10 C++ Intellisense, for example, uses a SQLCE DB).
  • Microsoft JET Engine: the old beloved Access. If you come from VB6 I guess you know this.
Adriano Repetti
  • 65,416
  • 20
  • 137
  • 208
  • I was hoping there was a simple wizard like the one that came with VB6 which would install everything. The solution you suggested probably does that, but it seems to take it for granted that I am more familiar with making setups using projects inside a solution. – Osprey Mar 16 '12 at 13:34
  • There is! You can do everything with a wizard (even installing SQL Server Express, if you do not use ClickOnce to deploy). – Adriano Repetti Mar 16 '12 at 15:04
  • I already use SQL Server Express edition but the problem is that when I deploy the solution I have to install SQL Server Express Edition apart from the solution itself. But I want to make my app available on a website and I want a non technical person to able to simply download one setup, run it and it will automatically install SQL Server Express edition and attach the database in it. SQL needs to be installed with a specific set of username and password so that the application knows how to connect to it. – Osprey Mar 16 '12 at 15:15
  • For a web application use SQL Server Compact 4.0! From MSDN: > SQL Server Compact 4.0 is the default database for Microsoft WebMatrix, which is a stack of web technologies for easily building and deploying websites on the Windows platform. – Adriano Repetti Mar 16 '12 at 15:17
  • It is not a web application. It is a desktop application made with VB.Net. I want to have a zip file on a website which people can download and install hassle free. Just like when you download WinRar or some other app. You just download the file, execute the setup and you are ready to go. – Osprey Mar 16 '12 at 15:20
  • LocalDB is not in-process. Just look at task manager when your application is running. – ta.speot.is Jul 02 '13 at 11:44
0

If (and this is a big IF) your application is intended for a single user and you don't need data-sharing, now Microsoft provides a new version of SQLServer Express called LocalDB.
This version runs as standalone executable (isn't a service).
Its major advantage is the easy installation.
Search for LocalDB or look at my question LocalDB deployment

Community
  • 1
  • 1
Steve
  • 213,761
  • 22
  • 232
  • 286
  • Unfortunately I need too have the same database accessible through other work stations on the network. I think I will have to setup an automated SQL Server Express installation (through config file) and have the installer run this setup before the actual application setup. When SQL Server is installed and configured with the right sa password, the user will install the app which on first run will detect the SQL server instance but notice the missing database. At that point it will programmatically attach the database. At least that is the plan. I will let you know how it turns out. – Osprey Mar 17 '12 at 08:29
  • Yes, that was my deployment scenario, before LocalDB. It's difficult and very error prone because you need to pay attention to many details in your setup script. However it's feasible. I can only say test, test, test... :-) – Steve Mar 17 '12 at 08:50
  • I confirm that it is VERY error prone. Made the setup on Windows 7 and when I went to deploy it on a Win 2003 server I had all sorts of problems with missing Power Shells, Windows Installers etc.. And after the database was finally installed on the server, the work stations could not connect to it because I had to manually enable the TCP and Named Pipes configurations. I really miss the simplicity of a Access Database file simply placed on a server. – Osprey Mar 24 '12 at 06:47