SqlPackage.exe takes a long time


So we are working on adding SQL DACPACs as part of our continues integration. We do this with powershell script running “sqlpackage.exe” with each DacPac file. we have about 12 DBs so it’s about 12 DacPacs.

Everytime we run “sqlpackage.exe” to publish or script the DacPac we notice that it will take between 0.5-1+ min to complete initialization. Most of this time is being taken during initialization flow when “sqlpackage.exe” begins.

i’m trying to find a way to reduce this if possible since we have 12 DBs we are talking about at least 12 min for DB Deployment which is too much for us.

Do you know of any way to be able to reduce this?


The time up front is, I believe, used to get the current schema from the database, compare it to what’s in the dacpac, and come up with the change scripts required.
There is no way to eliminate that using a dacpac.

However, you could do it ahead of time by having SqlPackage create the upgrade scripts and then at deploy-time just run the scripts. This could reduce downtime to just the time it takes to run the script, and, as suggested, if run in parallel the down time could be dramatically reduced.

If all your DBs are guaranteed to be in the same (schema) state you could just create a single upgrade script off the first DB and run it on all DBs.


SqlPackage.exe takes a long time by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply