I am using SSDT in Visual Studio 2013.
I have created some pre and post publish scripts for the development server. The pre-deployment scripts empty data from tables
I would suggest to use SQLCMD Variables for your conditional script execution.
If right-click on a DB project and choose Properties, there is a tab "SQLCMD Variables"
Enter "$(ServerName)" as variable and something as default value.
Then you need to open your EVERY .publish.xml in XML editor to insert the following code after PropertyGroup part:
[YourVersionOfServer]
[YourVersionOfServer] should be equal to the result of @@servername on each of your servers.
The final .publish.xml might look like:
Then you should wrap you conditional code in pre and post deployment files with:
if @@servername = '$(ServerName)'
begin
... code for specific server
end
Thus you can guarantee that the right code hits the right server