Search code examples
sql-servervisual-studio-2015sql-server-2014sql-server-data-tools

SSDT is not updating my localdb database


I created a new database project from an existing database and all objects are imported correctly without any error.

From a start I can see that the localdb database is created but even after building the project it remains empty. This means, no tables or any other objects are created on the localdb database. Is there any reason for this?

I tried manually doing a schema comparison and updating all differences. This creates all objects successfully, but then any change I do within the project won't be reflected on the localdb database.

I guess there are not many things to check as I kept all options as default when I created the project.

First I checked the connection string and is pointing the right database (set by default). Then I tried also checking the "Always re-create database" option and after rebuilding is the same.


Solution

  • You need to publish he changes. I think doing F5 with the project as the default will do it (although I don't use that as you can't control what instance it goes to) or right click the project and choose publish.

    What I do is either create a publish profile and double click that or use a powershell script to publish them.

    One thing to note is publishing is quite slow so if you are making lots of small changes get one of the quick deploy tools like the ssdt dev pack https://visualstudiogallery.msdn.microsoft.com/435e7238-0e64-4667-8980-5b8a05dc7906 (I wrote it) and map QuickDeploy to a keyboard shortcut (I use ctrl+k,d) to bypass the publish and send a proc straight to the local I instance.

    Ed