Search code examples
.netdatabasepublishdatabase-projectdacpac

Delete table in database project


I am working on a .NET project which includes a database project (Dacpac).

I am attempting to delete a table, but when I publish the database project, the table is not deleted in the destination database.

enter image description here

I deleted the table in the database project, and as expected result, the table should have been deleted in the destination. However, the result was not as expected.


Solution

  • If you want the table to be deleted in the destination you need to configure your publish profile to "Drop objects in target but not in source" option. Here where you can activate it.

    After selecting 'Publish' on your database project you need to go to the 'Advanced' settings :

    Advanced settings

    Then go to the 'Drop' tab, and check "Drop objects in target but not in source":

    Drop tab