Skip to content

[Feature Request]: Ability to Mark Existing Scripts as Pre/Post-Deployment in SQL Projects #20715

@jasonhorner

Description

@jasonhorner

Feature Description

Summary

Currently, SQL Database Projects only allow adding new pre- or post-deployment scripts. There is no built-in way to mark an existing .sql file as a PreDeploy or PostDeploy item. The only workaround is manually editing the .sqlproj XML, which is error-prone and inconsistent with other project item workflows.

Problem

Developers commonly refactor scripts or want to convert an existing .sql file into a pre/post deployment script. Since the UI/commands always create a new file, users must hand-edit:

<PreDeploy Include="..." />
<PostDeploy Include="..." />
<Build Remove="..." />

This manual process often leads to build errors (SQL46010, SQL70001) and adds unnecessary friction, especially in VS Code and SDK-style SQL projects.

Requested Enhancement

Add a way to mark an existing SQL file as a Pre-Deployment or Post-Deployment script, via:

Right-click context menu

Command Palette action (SQL: Set as Pre-Deployment Script)

CLI option

Any equivalent UI flow

The action should automatically update the .sqlproj file correctly, without requiring users to create new scripts or manually edit XML.

Impact

This would reduce errors, simplify workflows, and improve usability for both new and experienced SQL project users

Problem and Motivation

See Above

Related Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

If you selected "Other", please describe the area

No response

Confirmation

  • I have searched existing feature requests and couldn't find a match
  • I want to help implement this feature

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions