To add a post-deployment script

  1. From the Solution Explorer, right-click the .Publish project and select Add > Script from the context menu.
  2. Under Installed, expand SQL Server and select User Scripts.
  3. In the center pane, select Post-deployment script.
  4. In the Name field, type a name for the script or accept the default name.
  5. Click Add.

    Visual Studio adds the script to the project and opens it in the text editor.