Database project fails to deploy on MS SQL Server

Posted on 2011-10-28
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:

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

Does anyone know what is going wrong here.
Question by:Wanting2LearnMan
    LVL 11

    Expert Comment

    What is the content of BackupDatabase.bat?

    Author Comment

    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

    Author Comment

    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=, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
      File name: 'Microsoft.SqlServer.BatchParser, Version=, 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


    Author Comment

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

    sqlspp.exe has stopped working.

    Accepted Solution

    I did not have the latest version of the database schema that is why it did not work. oops :)

    Author Closing Comment

    my mistake - I did not have the latest version of the database schema that is why it did not work

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now