Skip to content

Commit 86e15e7

Browse files
authored
Add Publish dialog article (#36430)
Co-authored-by: Iqra Shaikh <10712535+Iqra617@users.noreply.github.com>
1 parent b45e5ef commit 86e15e7

7 files changed

Lines changed: 96 additions & 0 deletions

File tree

docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8999,6 +8999,8 @@ items:
89998999
href: tools/visual-studio-code-extensions/sql-database-projects/getting-started-sql-database-projects-extension.md
90009000
- name: Build from the Command Line
90019001
href: tools/visual-studio-code-extensions/sql-database-projects/build-database-project-from-command-line.md
9002+
- name: Publish database project
9003+
href: tools/visual-studio-code-extensions/sql-database-projects/publish-database-project.md
90029004
- name: Tutorials
90039005
items:
90049006
- name: SQL Server

docs/tools/sql-database-projects/tutorials/create-deploy-sql-project.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,4 +385,5 @@ GitHub deployments can be further secured by establishing an environment relatio
385385

386386
- [Compare a database and a project](../howto/compare-database-project.md)
387387
- [Convert an original SQL project to an SDK-style project](../howto/convert-original-sql-project.md)
388+
- [Publish SQL database projects from Visual Studio Code](../../visual-studio-code-extensions/sql-database-projects/publish-database-project.md)
388389
- [SqlPackage Publish parameters, properties, and SQLCMD variables](../../sqlpackage/sqlpackage-publish.md)

docs/tools/visual-studio-code-extensions/sql-database-projects/build-database-project-from-command-line.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ msbuild AdventureWorks/AdventureWorks.sqlproj
4242

4343
## Related content
4444

45+
- [Publish SQL database projects from Visual Studio Code](publish-database-project.md)
4546
- [SQL Database Projects extension](sql-database-projects-extension.md)
4647
- [Tutorial: Create and deploy a SQL project](../../sql-database-projects/tutorials/create-deploy-sql-project.md)
4748
- [Get help with the SQL Database Projects extension](https://github.com/microsoft/azuredatastudio/issues)
23.6 KB
Loading
22 KB
Loading
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: Publish SQL Database Projects from Visual Studio Code
3+
description: Learn how to publish SQL database projects from Visual Studio Code using the Publish dialog.
4+
author: rwestMSFT
5+
ms.author: randolphwest
6+
ms.reviewer: iqrashaikh, drskwier
7+
ms.date: 02/04/2026
8+
ms.service: sql
9+
ms.subservice: sql-database-projects
10+
ms.topic: how-to
11+
ms.collection:
12+
- data-tools
13+
---
14+
# Publish SQL database projects from Visual Studio Code
15+
16+
Use the SQL Database Projects extension for Visual Studio Code to deploy database schema changes directly from a SQL project.
17+
18+
A SQL project deployment takes the schema you define in the project, compares it to the target database, and applies only the necessary changes to bring the database into the desired state through a dynamically generated plan.
19+
20+
You can review changes, generate a deployment script, and publish updates to a target database without leaving the editor.
21+
22+
## Prerequisites
23+
24+
Before you begin, make sure you have:
25+
26+
- Visual Studio Code installed
27+
- The MSSQL extension for Visual Studio Code
28+
- The SQL Database Projects extension
29+
- An existing SQL database project (`.sqlproj`)
30+
- Access to a SQL Server or Azure SQL Database target
31+
32+
## Open the Publish dialog
33+
34+
You can open the Publish dialog from the **Database Projects** view.
35+
36+
1. Open the **Database Projects** view.
37+
1. Right-click your SQL project.
38+
1. Select **Publish**.
39+
40+
The Publish dialog opens in a new editor tab.
41+
42+
:::image type="content" source="media/publish-database-project/publish-dialog.png" alt-text="Screenshot of Publish Project dialog showing publish target, server, and database fields."
43+
44+
## Configure the publish target
45+
46+
Use the Publish dialog to select where to deploy the project.
47+
48+
1. Select a **Publish target**, such as SQL Server or Azure SQL.
49+
50+
1. Select a **Server** connection.
51+
52+
- If you're not connected, the connection dialog opens.
53+
- You can select an existing connection or create a new one.
54+
55+
1. Select the target **Database**.
56+
57+
After you establish a connection, the dialog shows more actions.
58+
59+
> [!NOTE]
60+
> Make sure that the database type you're publishing to matches the project's **Target platform** setting. If they don't match, either change the project's target platform to align with the database, or, if you're confident that the project is compatible, use the advanced option in the Publish dialog that allows publishing to an incompatible platform.
61+
62+
## Generate a deployment script
63+
64+
Before publishing, you can generate a deployment script to review the changes that the process makes to the database.
65+
66+
1. In the Publish dialog, select **Generate Script**.
67+
1. Wait for the script to generate.
68+
69+
The editor opens the generated script for review.
70+
71+
> [!NOTE]
72+
> The deployment script includes SQLCMD variables for the connection and other deployment settings. Make sure SQLCMD mode is enabled in the editor, so that the variables resolve correctly when you run the script as a query.
73+
74+
:::image type="content" source="media/publish-database-project/deployment-script.png" alt-text="Screenshot of generated deployment script opened for review in the editor.":::
75+
76+
## Publish changes
77+
78+
After reviewing the deployment script, publish the changes.
79+
80+
1. Go back to the Publish dialog.
81+
1. Select **Publish**.
82+
1. If prompted, confirm or select a database connection.
83+
84+
The project is deployed to the selected target database.
85+
86+
## Related content
87+
88+
- [What are SQL database projects?](../../sql-database-projects/sql-database-projects.md)
89+
- [Get started with the SQL Database Projects extension](getting-started-sql-database-projects-extension.md)
90+
- [Tutorial: Create and deploy a SQL project](../../sql-database-projects/tutorials/create-deploy-sql-project.md)
91+
- [What is the MSSQL extension for Visual Studio Code?](../mssql/mssql-extension-visual-studio-code.md)

docs/tools/visual-studio-code-extensions/sql-database-projects/sql-database-projects-extension.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,5 @@ In the following example `.code-workspace` file, the `folders` array lists all f
113113

114114
- [What are SQL database projects?](../../sql-database-projects/sql-database-projects.md)
115115
- [Get started with the SQL Database Projects extension](getting-started-sql-database-projects-extension.md)
116+
- [Publish SQL database projects from Visual Studio Code](publish-database-project.md)
116117
- [Get help with the SQL Database Projects extension](https://github.com/microsoft/azuredatastudio/issues)

0 commit comments

Comments
 (0)