0

I am working on creating a visual studio database solution so that i could deploy databases in a more managed manner. Following are the steps that i performed after adding some sample tables and SPs in the solution.

  1. Deploy the database to my local machine (and a new database is created).
  2. Add some mock data to the tables in SSMS.
  3. Add couple of columns to one of the tables in the VS 2010 solution.
  4. Build the solution and deploy the database again (this time it deploys only the changes made to the schema).
  5. Verfiy that the existing data was intact and new columns have been added to the table schema.

Everything is working as expected till this point.

  1. Now I delete the database manually which was created by the deployment.
  2. Go to VS 2010 and deploy the solution (expecting that it should do a clean deployment of the database), however i get the following error :

    ------ Deploy started: Project: MyDatabase, Configuration: Debug Any CPU ------

    Pre-Deploy: Starting script execution…

    Pre-Deploy: Finished script execution.

    MyDatabase.dacpac(0,0): Error : -->Cannot upgrade the DAC for database MyDatabase, a database with that name does not exist. Specify a valid database name.

Is there any setting in my solution where i could specify that the deployment should do a clean install if the database does not exist?

Or

Do i need to write separate (database creation) scripts if the database does not exist?

Vaibhav Pingle
  • 575
  • 1
  • 9
  • 27

1 Answers1

0

I ran into this issue as well. I deleted the database and could not deploy again. Then I found this link. DAC application needs to be deleted in the SQL Server Management Studio.

http://msdn.microsoft.com/en-us/library/ee240822.aspx

To Delete a DAC application In SQL Server Management Studio connect to the database Expand the Management node. Expand the Data-tier Applications node. Right-click the DAC to be deleted, and then select Delete Data-tier Application… Complete the wizard dialogs:

I deleted the application and was able to deploy again. I am still learning that DAC is application.