How to insall a database with an application? - sql-server

This seems like it would be easy as pie but it is not. I would like to include a sql server database with my application installation. I see a lot of similar questions, so let me be clear: I know how to set up prerequisites, but I want to include my application's database with the installation.
I am using Visual Studio 2010. I have a project with a local database. I have a setup project. However, when I generate the setup.exe and install the app, no database is generated and the app does not work.
I hope that the answer to this is as simple as it seems it should be. How do I include my application's database with the rest of the application in the setup.exe?

Got it! My solution:
In the setup project right click the project and select View > File System. Then right click the Application Folder folder and select Add > File...
Then browse to .mdf file, select it and bam! Included in the installation.

Related

SQL Database not linking to local svn repository in Redgate Source Control

I am trying to link by database to Redgate Source Control but I am getting the error.
I have repository in SVN Source Control system in local folder.
Version of Redgate Source Control: 7.0.6.8775
SVN version: TortoiseSVN 1.11.0
Following is the error message.
Unable to connect to a repository at URL 'file:///D:/SVNRepo/DevDB'
Screenshot: https://www.screencast.com/t/2pPpZbR1
Anybody know how to fix?
I solve it, it was version issue.
I created the repository in TortoiseSVN 1.9.4 and it works.
If you want to connect it to a local folder, then you must tell it to connect to Working folder from the left pane. You told it to connect to SVN, but giving it a path to a folder. Click the radio button next to Working folder and browse to the folder where your working copy is stored, or where you want to make one.

How to create software .exe file attached it with database which can able to run on different machine?

i have developed application using vb.net for windows system. which have sql server 2008 database and also includes crystal reports. and i want to create .exe of project. For distribution.Then how can i do that. Please help.. I am trying to do this with visual studio 2010.. Using traditional method...
1.Go to File | Add and click New Project.
2.In the Add New Project dialog box, select Other Project 3.Types and choose the Setup And Deployment Projects folder..and so on..till adding project output and primary output.but after clicking on primary output it give message like..The following files may have dependencies that can not be determinited automatically. Please confirm that all dependencies have been added to the project c:\windows\system32 \macromed\flash\flash.ocx.. Please help me to solve this..
Your question and your error arent related.
For your client, you need to install Sql Express.
LocalDB deployment on client PC
For the flash error, you need to check where you are using flash and make sure is also installed.

WIX Deployment: Which files to deploy?

This might be a very trivial question but deployment is new to me and little confused about which file to deploy.
I have a WPF test project uses Entity framework in visual studio and trying to use WIX to deploy it. Target machine is running windows 7. Given that .Net Framework and sql server localdb is installed on the target machine what files I need to deploy (make component in the WIX xml file)? I have tried copying the whole bin/Release folder to the target machine and it works. However I don’t know if that is necessary. The following screenshot shows the bin\Release directory of my application.
The problem is I don’t know the job of some files particularly the files with the following extensions:
.exe.config
.pdb
.vshost.exe
.vshost.exe.config
The database file is located in the Users\[username] directory and gets created if it doesn’t exist so I suppose it’s not part of the deployment.
Additionally I would like to understand two xml files-
EntityFramework.SqlServer.xml
EntityFramework.xml
Do I need to deploy these two files as well?
exe.config
Several settings you can change here - if defined in the Project building the EXE. You probably want to deploy this.
.pdb
Debugfiles. Deploy if you are investigating errors - else don't, these contain source information.
.vshost.exe
.vshost.exe.config
Do not deploy. These are used/generate by Visual Studio. If you start a Project out of Visual Studio it is ran in a hosted process environment so it cannot crash Visual Studio when then application runs into an error. Not for production.
EntityFramework.SqlServer.xml
EntityFramework.xml
This is documentation for the corresponding dlls. Useful for development, I do not think you want to deploy them thou.

Deploying Umbraco to Azure. All files not included

I've created an Umbraco project locally following instructions from here:
https://our.umbraco.org/documentation/using-umbraco/creating-basic-site/
VS version: VS 2013 Pro
Umbraco version is 7.2.1
SQL version: SQL Server 2008 r2
All working fine locally, created master template, some page templates and some content. Now I would like to push the site live, both layout and content, using an Azure Website. I created the SQL DB on Azure using the app from:
https://sqlazuremw.codeplex.com/
I've verified the DB looks correct by doing a Schema compare and Data compare through VS SQL Server Object Explorer.
I published the site via VS 2013, right click project, publish, Azure Web Site and all went through as expected.
Problem
When trying to view the site it's just returning a blank page, no HTML in the source. Looking at the files which have been uploaded to Azure, it appears that some files from the Views directory weren't uploaded e.g. ContentMain.cshtml, Homepage.cshtml, Master.cshtml.
Looking at my local project source, none of those files are included in the project i.e. the icon has a dotted outline. Presumably this is something to do with the fact they were originally created via the browser?
Is it expected that those files aren't supposed to be part of the project and therefore aren't included when publishing to Azure?
I'm guessing that it would work fine if I simply right click and include each of the files then re-deploy. However I don't want to cause some other issue in Umbraco by doing so.
What is the best practice advice to get round this?
Cheers,
Lee
Is it expected that those files aren't supposed to be part of the project and therefore aren't included when publishing to Azure?
I'm guessing that it would work fine if I simply right click and
include each of the files then re-deploy.
I think it's correct. Templates created by Umbraco back-office are not included automatically in Visual Studio Project and VS cannot publish items not included in project.
A better approach is to create your templates directly in your VS Project.

Deploy Visual Studio 2010 Database Project

I have a Visual Studio 2010 Database project, from which I want to generate a script
that simply puts up this database to another machine. The problem is that i can't find a
solution for this.
As I started the project, I imported the shema from a database on my development pc.
The Schema Objects were generated and all tables and scripts where under 'Schema Objects -> Schemas -> dbo'. Over the time, some things changed, some where added. And by using right-click -> deploy,
the changes were made to my local database successfully.
But now I want to deploy to another machine. The problem is, that in the release folder of the project, there is only a xml dbschema file containing all tables and scripts that i can't import
with sql management studio (or i just can't find out how) and the a deployment script which is nothing more than some checks followed by the pre- and post- deployment script, but without any tables or scripts in it.
So please, how do i export the database from Visual Studio, so i can easily put it up on another machine?
Marks--
You likely have already resolved this, but I thought I should answer your questions for the benefit of others.
Yes, you can deploy from Visual Studio to different machines. You can also do it from the command line, using VSDBCMD. And you can create a WIX project to give a wizard for others to install it with.
If you can connect to the target database from your dev PC, you can deploy to it. To do this:
Select another Configuration from the Solution Configuration drop down. Normally, the Project will come with "Debug" and "Release" baked in. You can add another configuration to allow you to deploy to various targets by clicking "Configuration Manager."
Right-click your Project and select 'Properties', or simply double-click Properties under the project.
Click the Deploy tab. Notice that the Configuration: drop-down shows the same selected configuration as "active."
Change the Deploy Action to "Create a deployment script (.sql) and deploy to the database."
Next to Target Connection String, click "Edit" and use the dialog to create your deployment connection to the target database.
Fill in the Target database name, if different.
For each Deployment Configuration (e.g., Debug, Release, etc.), you will probably want a separate Deployment configuration file. If you click "New," you can create one for the current configuration. The new file will open, and you can check and uncheck important things about the deployment.
Note: If you check Always re-create the database, the script will DROP and CREATE your database. You will lose all your data on the target! Be careful what you select here. Most people leave that unchecked for a Production target. I check it for Development or Local because I want a fresh copy there.
Save your changes to the file and to Properties.
To deploy to the target, be sure to select the correct Configuration. Click Build/Deploy [My Database Name]. You probably should experiment with this so you are familiar with how it works before trying it on a live environment.
Good practices: build a similar environment to production ("Staging") and deploy there first, to test the deployment, and always back up the database before deploying, in case something goes wrong.
For more info, please see:
Working with Database Projects
Walkthrough: Put an Existing Database Schema Under Version Control
Visual Studio 2010 SQL Server Database Projects
Is it's possible to point your Visual Studio to your new target database? 1. Properties of your Database project, Deploy tab, set the fields in Target Database Settings.
Now when you generate a deploy script, the resulting SQL file will be the various CREATe / ALTER / DROP etc that will align the target database with your schema.
You could always create an empty database and then do a schema compare in Visual Studio between your database project and the new empty database. You can amend the generated schema update script to also create the database (since the script will be to update an existing empty database)

Resources