Visual Studio 2008 Database project for SQL Server 2008
The project has placeholders for Pre-Deployment and Post-Deployment SQL scripts. They work - well, most of the time anyways.
The project has an option to Always-Recreate-Database: drop the existing database and create a fresh hot-from-the-oven database every time.
When I deploy my database the entire SQL Script is put together and executed.
My database is used for replication, and as a part of the Post-Deployment script, I designate the server as a distribution, create the replication and add articles to it.
Therefore, I have to shut off replication. And the logical place to put that was in the Pre-Deploy.
VS2008 wiped the smug grin off my face pretty quickly. If Always-Recreate-Database is checked then it puts the script to drop and recreate the database, then puts my Pre-Deployment script, and then everything else.
Is there any way for me to change the template of the database project so that the Pre-Deployment SQL scripts are executed where they are meant to execute - before any deployment occurs.