SQL Server Express Edition needs to be installed with Visual studio .Net installer project, so that silent installation of SQL Server Express edition can be performed.
• Create a new Setup and Deployment project
• Put all the files extracted from SQL Server Express Edition exe in application folder of installer.
• Add Backup file to be restored.
• Check in code project sample,there will be code to check IsDone and IsRestart, left both of this checking as it is, since it is the condition that Installation class left for us to tell the main Startup Form what to do, whether to close the application or to show the form.
• When you first run your application, it checks if the database instance exists, if not it will install the database instance, and restore the backup database to the new database instance.