?
Solved

Database project fails to deploy on MS SQL Server

Posted on 2011-10-28
6
Medium Priority
?
863 Views
Last Modified: 2012-05-12
I have MS SQL SERVER 2008 installed.

I am trying to deploy a database solution that was created using VS2010.

I am getting the errors:
------ Deploy started: Project: MyProject, Configuration: Debug Any CPU ------
Target "CheckRequiredProperties" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.Common.targets" from project "C:\\MyProject\MyProject.dbproj" (entry point):
Target "_CheckForInvalidConfigurationAndPlatform" in file "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets" from project "C:\MyProject\MyProject.dbproj" (entry point):
 Task "Message"
 Done executing task "Message".
 Task "Message"
 Done executing task "Message".
Target "PreDeploy" in project "C:\MyProject\MyProject.dbproj" (target "Deploy" depends on it):
 Task "Exec"
  BackupDatabase.bat Debug MyProject Data Source=localhost;Integrated Security=True;Pooling=False
  Script Name: BackupDatabase.bat
  Configuration: Debug
  DatabaseName: MyProject
Sqlcmd(0,0): Error : Connection failure. SQL Native Client is not installed correctly. To correct this, run SQL Server Setup.
C:\MyProject\MyProject.dbproj(1017,5): Error MSB3073: The command "BackupDatabase.bat Debug MyProject Data Source=localhost;Integrated Security=True;Pooling=False" exited with code 1.
 Done executing task "Exec" -- FAILED.
Done building target "PreDeploy" in project "MyProject.dbproj" -- FAILED.
Done building project "MyProject.dbproj" -- FAILED.

Open in new window


I don't know what it wrong.
When I launch SQL Server Management Server it asks me to select a 'Server Name'
There are 3 present here:
MYCOMPUTERNAME
MYCOMPUTERNAME\NEW_MSSQLSERVER
MYCOMPUTERNAME\SQLEXPRESS

First, how do I uninstall the servers:
MYCOMPUTERNAME\NEW_MSSQLSERVER
MYCOMPUTERNAME\SQLEXPRESS
as these have been created by me as I tried to install a fesh install of SQL Server.

Secondly,
Does anyone know what is going wrong here.
0
Comment
Question by:Wanting2LearnMan
  • 5
6 Comments
 
LVL 11

Expert Comment

by:dougaug
ID: 37046711
What is the content of BackupDatabase.bat?
0
 

Author Comment

by:Wanting2LearnMan
ID: 37049754
It is:
REM --------------------------------------------------------------------------------------
REM Script Name:      BackupDatabase
REM Description:      Backs up the database before a deployment is done.
REM Justification:      This enables developers to retain their test data when they do a
REM                              database deployment (only runs in a DEBUG build).
REM --------------------------------------------------------------------------------------

ECHO Script Name: %0%
ECHO Configuration: %1%
ECHO DatabaseName: %2%

IF "%1%" EQU "Debug" (
      SQLCMD -b -S localhost -i BackupDatabase.sql -v TargetDatabaseName = %2 BackupDatabaseName = %2_backup
)
0
 

Author Comment

by:Wanting2LearnMan
ID: 37049832
I see that it has the comment:
"This enables developers to retain their test data when they do a database deployment (only runs in a DEBUG build)."
So I set VS2010 to Release, when I do I deploy now I get:

 PostDeployment.bat Release ..\..\..\Output\Database\MyProject\ MyProject.sql
  'n++REM' is not recognized as an internal or external command,
  operable program or batch file.
  Script Name: PostDeployment.bat
  Configuration: Release
  Output Folder: ..\..\..\Output\Database\MyProject\
  SQL Filename: MyProject.sql
  OutputPath: "..\..\..\Output\Database\MyProject\MyProject.sql"
  AlternatePath: "D:\TFSBuild\\TrunkDaily\Sources\Install\MyProject\Script Files\MyProject.sql"
  SQL file found at output path ..\..\..\Output\Database\MyProject\MyProject.sql.
  Commencing post-processing
  Input File: "..\..\..\Output\Database\MyProject\MyProject.sql"
  Output File: "..\..\..\Output\Database\MyProject\MyProjectInstall.sql"
  ExecuteScriptPreprocessor.bat "..\..\..\Output\Database\MyProject\MyProject.sql" "..\..\..\Output\Database\MyProject\MyProjectInstall.sql"
  "BEGIN ExecuteScriptPreprocessor"
  "Input file: "..\..\..\Output\Database\MyProject\MyProject.sql""
  "Output file: "..\..\..\Output\Database\MyProject\MyProjectInstall.sql""
  "C:\Program Files (x86)\Microsoft Visual Studio 9.0\DBPro\sqlspp.exe" /i:"..\..\..\Output\Database\MyProject\MyProject.sql" /o:"..\..\..\Output\Database\MyProject\MyProjectInstall.sql"
  Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
  File name: 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
     at Microsoft.VisualStudio.TeamSystem.Data.PowerTools.SqlScriptPreProcessor.Program.Main(String[] args)
  WRN: Assembly binding logging is turned OFF.
  To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
  Note: There is some performance penalty associated with assembly bind failure logging.
  To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
  "END ExecuteScriptPreprocessor"
  CScript EditCreateStatement.vbs "..\..\..\Output\Database\MyProject\MyProjectnstall.sql"
  Microsoft (R) Windows Script Host Version 5.8
  Copyright (C) Microsoft Corporation. All rights reserved.
C(0,0): Error : File not found
C:\MyProject\MyProject.dbproj(1020,5): Error MSB3073: The command "PostDeployment.bat Release ..\..\..\Output\Database\MyProject\ MyProject.sql" exited with code -1.
 Done executing task "Exec" -- FAILED.
Done building target "PostDeploy" in project "MyProject.dbproj" -- FAILED.
Done building project "MyProject.dbproj" -- FAILED.

Build FAILED.

Open in new window

0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 

Author Comment

by:Wanting2LearnMan
ID: 37049838
Oh I forgto to mention that when the deployment has started an error message pops up saying:

sqlspp.exe has stopped working.
0
 

Accepted Solution

by:
Wanting2LearnMan earned 0 total points
ID: 37302654
I did not have the latest version of the database schema that is why it did not work. oops :)
0
 

Author Closing Comment

by:Wanting2LearnMan
ID: 37324931
my mistake - I did not have the latest version of the database schema that is why it did not work
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question