If you deploy your database with TFS,
You probably use Pre-Deployment and Post-Deployment scripts
The important thing to note is that the process is:
- sqlpackage compares the dacpac to the database and generates a list of changes to make
- Pre-Deployment scripts executed
- Auto generated script of changed executed (from point #1)
- Post-Deployment scripts executed
As you can see,
The Pre-Deployment scripts are not actually
executed before the compare.
scripts before sqlpackage compares the dacpac
to the database and generates a list of changes to make.
What you can do is to add a step that will execute the scripts
in the Pre-Deployment folder
Before executing the step of sqlpackage.
By this, the ‘compare’ will bedone after the Pre-Deployment scripts were executed.