You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tools/sql-database-projects/howto/convert-original-sql-project.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: "Create an SDK-style SQL project from an existing project."
4
4
author: dzsquared
5
5
ms.author: drskwier
6
6
ms.reviewer: maghan, randolphwest
7
-
ms.date: 03/11/2025
7
+
ms.date: 06/27/2025
8
8
ms.service: sql
9
9
ms.subservice: sql-database-projects
10
10
ms.topic: how-to
@@ -311,6 +311,30 @@ When schema comparison is run, no results should be displayed. The lack of diffe
311
311
> [!NOTE]
312
312
> The comparison of `.dacpac` files through schema comparison doesn't validate pre/post-deployment scripts, refactorlog, or other project settings. It only validates the database model. Using the DacpacVerify command-line utility is the recommended way to validate that the two `.dacpac` files are equivalent.
313
313
314
+
## Step 6: Solution files
315
+
316
+
Your project file might be referenced in a solution file (`.sln`). If you have a solution file, you should update it to reference the new SDK-style project file.
317
+
318
+
### Optional: Create a new solution file
319
+
320
+
For a solution file that only contains the SQL project, it is more straightforward to remove the solution file and create a new solution file with the SDK-style project.
When a solution file contains multiple projects, you should update the solution file to reference the new SDK-style project file. You can edit the solution file in a text editor and change the project reference to the new SDK-style project file. The project reference in the solution file should look like this:
The `PROJECT_TYPE_GUID` value for a Microsoft.Build.Sql project is `42EA0DBD-9CF1-443E-919E-BE9C484E4577`, and the `PROJECT_GUID` is a unique identifier for the project found in the project file `<ProjectGuid>` element. The `PROJECT_GUID` value is not required to be changed and can remain the same as in the original project file. The `PROJECT_TYPE_GUID` value is required to be changed to the Microsoft.Build.Sql project type GUID.
337
+
314
338
## Related content
315
339
316
340
-[What are SQL database projects?](../sql-database-projects.md)
@@ -3,8 +3,8 @@ title: SqlPackage in Development Pipelines
3
3
description: Learn how to troubleshoot database development pipelines with SqlPackage.
4
4
author: dzsquared
5
5
ms.author: drskwier
6
-
ms.reviewer: maghan
7
-
ms.date: 04/15/2025
6
+
ms.reviewer: maghan, randolphwest
7
+
ms.date: 06/27/2025
8
8
ms.service: sql
9
9
ms.subservice: tools-other
10
10
ms.topic: conceptual
@@ -16,35 +16,56 @@ ms.collection:
16
16
17
17
**SqlPackage** is a command-line utility that automates several database development tasks and can be incorporated into CI/CD pipelines.
18
18
19
+
> [!NOTE]
20
+
> Utilizing a [standalone installation of SqlPackage](sqlpackage-download.md) for pipeline automation is recommended over using the SqlPackage executables bundled with other applications, including SQL Server Management Studio or Visual Studio. The standalone installation of SqlPackage is updated more frequently and isn't tied to the release cadence of other applications.
19
21
20
-
## Virtual environments
22
+
If SqlPackage is installed as a global dotnet tool (recommended), you can invoke it in the pipeline with simply `sqlpackage` from any directory. If SqlPackage is installed as a standalone executable, you must specify the full path to the executable in the pipeline. On Windows, the standalone install of SqlPackage is available on the path `C:\Program Files\Microsoft SQL Server\170\DAC\bin` (DacFx.msi). In both Windows and Linux environments, if you download the self-contained .zip SqlPackage for .NET, you can extract the executable to a location of your choosing.
21
23
22
-
> [!NOTE]
23
-
> Utilizing a standalone installation of SqlPackage for pipeline automation is recommended over using the SqlPackage executables bundled with other applications, including SQL Server Management Studio or Visual Studio. The standalone installation of SqlPackage is updated more frequently and is not tied to the release cadence of other applications.
24
+
## Managed virtual environments
24
25
25
-
On Windows, the standalone install of SqlPackage is available on the path `C:\Program Files\Microsoft SQL Server\170\DAC\bin` (DacFx.msi) or `%USERPROFILE%\.dotnet\tools` (dotnet tool). On Linux, the standalone install of SqlPackage is available on the path `~/.dotnet/tools` (dotnet tool). In both Windows and Linux environments, if you download the self-contained .zip SqlPackage for .NET Core, you can extract the executable to a location of your choosing.
26
+
The virtual environments used for GitHub Actions hosted runners and Azure Pipelines virtual machine images are managed in the [runner-images](https://github.com/actions/runner-images) GitHub repository. SqlPackage is included in several environments including `windows-latest` and `ubuntu-22.04` but is no longer included by default in `ubuntu-24.04` and `ubuntu-latest`. Updates to the images in [runner-images](https://github.com/actions/runner-images) are made within a few weeks of each SqlPackage release.
26
27
27
-
### Managed virtual environments
28
+
In a managed virtual environment, you would install SqlPackage at runtime in the pipeline. The installation is performed as a separate step in either Azure Pipelines and GitHub Actions and adds a short delay to each pipeline run while the installation occurs. To install SqlPackage at runtime, add a step to the pipeline that uses the dotnet CLI to install SqlPackage as a global tool. This step should be run before any SqlPackage actions in the pipeline.
28
29
29
-
The virtual environments used for GitHub Actions hosted runners and Azure Pipelines virtual machine images are managed in the [runner-images](https://github.com/actions/runner-images) GitHub repository. SqlPackage is included in several environments including `windows-latest` and `ubuntu-22.04` but is no longer included by default in `ubuntu-24.04` and `ubuntu-latest`. Updates to the images in [runner-images](https://github.com/actions/runner-images) are made within a few weeks of each SqlPackage release.
30
+
```bash
31
+
dotnet tool install --global Microsoft.SqlPackage
32
+
```
30
33
31
-
### Self-hosted virtual environments
34
+
You might need to perform a .NET setup step in the pipeline before installing SqlPackage, indicated by an error message stating that .NET can't be found. Use an integrated action to configure it such as the [UseDotNet](/azure/devops/pipelines/tasks/reference/use-dotnet-v2) task in Azure Pipelines or the [setup-dotnet](https://github.com/actions/setup-dotnet) action in GitHub Actions.
32
35
33
-
In a self-hosted virtual environment such as a self-hosted Azure DevOps agent, [update the application](sqlpackage-download.md) regularly to maintain the environment with the latest version.
36
+
Optionally, you can specify a version of SqlPackage to install by appending `--version <version>` to the install command or you can use the `--prerelease` flag to install a preview versions.
34
37
35
-
##Tracking deployments
38
+
### Example: Steps to install SqlPackage in Azure DevOps Pipelines
36
39
37
-
You can capture some files related to SqlPackage to reproduce pipelines and improve deployment tracking. The implementation and use cases depend on your specific architecture and automation environment.
40
+
In Azure DevOps Pipelines, you can use the [UseDotNet](/azure/devops/pipelines/tasks/reference/use-dotnet-v2) task to install the .NET SDK and then install SqlPackage as a global tool. If you're using a Windows agent provided by Microsoft, SqlPackage is already installed in `C:\Program Files\Microsoft SQL Server\170\DAC\bin`. If you're using a self-hosted agent, you can also install SqlPackage on the host environment and skip this step in the pipeline.
38
41
39
-
-**Dacpac file**
40
-
-**Diagnostic file output from any action:** Use the `/DiagnosticsFile:` parameter on any SqlPackage action, see [Get SqlPackage diagnostics in a pipeline agent](#get-sqlpackage-diagnostics-in-a-pipeline-agent)
41
-
-**Output from script action prior to publish action:** Use the [Script](sqlpackage-script.md) SqlPackage action before invoking a publish action
displayName: 'Install specific version of SqlPackage'
49
+
```
42
50
43
-
##Other SqlPackage examples
51
+
### Example: Steps to install SqlPackage in GitHub Actions
44
52
45
-
### Checking the SqlPackage version
53
+
In GitHub Actions, you can use the [setup-dotnet](https://github.com/actions/setup-dotnet) action to install the .NET SDK and then install SqlPackage as a global tool. If you're using a Windows runner provided by GitHub, SqlPackage is already installed in `C:\Program Files\Microsoft SQL Server\170\DAC\bin`. If you're using a self-hosted runner, you can also install SqlPackage on the host environment and skip this step in the workflow.
46
54
47
-
During troubleshooting efforts, it's important to know the SqlPackage version is in use. Capturing this information can be done by adding a step to the pipeline to run SqlPackage with the `/version` parameter. Examples are given in this article based on the Microsoft and GitHub managed environments, self-hosted environments may have different installation paths for the working directory.
During troubleshooting efforts, it's important to know the SqlPackage version is in use. Capturing this information can be done by adding a step to the pipeline to run SqlPackage with the `/version` parameter. Examples are given in this article based on the Azure DevOps and GitHub managed environments, self-hosted environments might have different installation paths for the working directory.
48
69
49
70
#### Azure Pipelines
50
71
@@ -58,7 +79,7 @@ In an Azure Pipeline, the [script](/azure/devops/pipelines/yaml-schema/steps-scr
58
79
59
80
#### GitHub Actions
60
81
61
-
In a GitHub Action workflow, the [run](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) keyword returns the SqlPackage version number.
82
+
In a GitHub Action workflow, the [run](https://docs.github.com/actions/reference/workflow-syntax-for-github-actions) keyword returns the SqlPackage version number.
62
83
63
84
```yaml
64
85
- name: get sqlpackage version
@@ -68,12 +89,78 @@ In a GitHub Action workflow, the [run](https://docs.github.com/en/actions/using-
68
89
69
90
:::image type="content" source="media/sqlpackage-pipelines-github-action.png" alt-text="GitHub action output displaying build number 15.0.4897.1":::
70
91
71
-
### Get SqlPackage diagnostics in a pipeline agent
92
+
### Update SqlPackage on the pipeline agent
93
+
94
+
In some scenarios, the current version of SqlPackage installed in the pipeline environment might be insufficient. If the environment can't be directly modified, an extra step can be used to install a newer version of SqlPackage during the pipeline run. It's important to run the install step before running any DacPac or BacPac operations in the pipeline. This task can be combined with a step to [check the version](#checking-the-sqlpackage-version) to ensure that the upgrade completed as expected.
95
+
96
+
#### Azure Pipelines, Windows-based agent
97
+
98
+
When the [PowerShell](/azure/devops/pipelines/tasks/utility/powershell) task is used in an Azure Pipeline, a step can be added to an Azure Pipeline that downloads the desired DacFx installer and installs it silently.
In a GitHub Action workflow, you can use the [run](https://docs.github.com/actions/reference/workflow-syntax-for-github-actions) keyword to execute the `dotnet tool` commands to install, uninstall, or update SqlPackage. The following example shows how to update SqlPackage to the latest preview version:
In a self-hosted virtual environment such as a self-hosted Azure DevOps agent or GitHub Actions runner, you can install SqlPackage on the host environment or install SqlPackage at runtime as described in [managed virtual environments](#managed-virtual-environments). If you install SqlPackage on the host environment, pipelines that run on that host don't need to install SqlPackage at runtime, which can speed up the pipeline runs. When SqlPackage is installed on the host, you should [update SqlPackage](sqlpackage-download.md) regularly to maintain the environment with the latest version.
123
+
124
+
[Azure Container Apps jobs](/azure/container-apps/tutorial-ci-cd-runners-jobs) can be used to deploy self-hosted runners in a container that is deployed as needed for each workflow invocation. With Container Apps jobs, you control the environment as defined in the Dockerfile and install SqlPackage and other tools as needed. The self-hosted runner can be configured to run on a specific version of SqlPackage by including the installation step in the container image. For example, the [tutorial](https://github.com/Azure-Samples/container-apps-ci-cd-runner-tutorial/tree/main) includes a Dockerfile that installs `curl` and `jq`.
125
+
126
+
We can modify this example to produce a container image that installs .NET 8.0 and SqlPackage:
127
+
128
+
```dockerfile
129
+
FROM ghcr.io/actions/actions-runner:2.323.0
130
+
131
+
USER root
132
+
133
+
# install dotnet sdk and sqlpackage
134
+
RUN apt-get update && apt-get install -y dotnet-sdk-8.0 && \
You can capture some files related to SqlPackage to reproduce pipelines and improve deployment tracking. The implementation and use cases depend on your specific architecture and automation environment.
150
+
151
+
- **Dacpac file**
152
+
153
+
- **Diagnostic file output from any action:** Use the `/DiagnosticsFile:` parameter on any SqlPackage action. For more information, see [Get SqlPackage diagnostics in a pipeline agent](#get-sqlpackage-diagnostics-in-a-pipeline-agent)
154
+
155
+
- **Output from script action prior to publish action:** Use the [Script](sqlpackage-script.md) SqlPackage action before invoking a publish action
156
+
157
+
## Get SqlPackage diagnostics in a pipeline agent
72
158
73
159
Diagnostic information from SqlPackage is available in the command line through the parameter `/DiagnosticsFile`, which can be used in virtual environments such as Azure Pipelines and GitHub Actions. The diagnostic information is written to a file in the working directory. The file name is dictated by the `/DiagnosticsFile` parameter.
74
160
75
-
#### Azure Pipelines
76
-
Adding the `/DiagnosticsFile` parameter to the "Additional SqlPackage Arguments" field in the Azure Pipeline SqlAzureDacpacDeployment configuration causes the SqlPackage diagnostic information to be written to the file specified. Following the SqlAzureDacpacDeployment task, the diagnostic file can be made available outside of the virtual environment by publishing a pipeline artifact as seen in the following example.
161
+
### Azure Pipelines
162
+
163
+
Adding the `/DiagnosticsFile` parameter to the "Additional SqlPackage Arguments" field in the Azure Pipeline SqlAzureDacpacDeployment configuration causes the SqlPackage diagnostic information to be written to the file specified. Following the SqlAzureDacpacDeployment task, the diagnostic file is available outside of the virtual environment by publishing a pipeline artifact as seen in the following example.
77
164
78
165
```yaml
79
166
- task: SqlAzureDacpacDeployment@1
@@ -97,22 +184,22 @@ Adding the `/DiagnosticsFile` parameter to the "Additional SqlPackage Arguments"
97
184
publishLocation: 'pipeline'
98
185
```
99
186
100
-
After the pipeline run, the diagnostic file can be downloaded from the run summary page under "Published Artifacts".
187
+
After the pipeline run, the diagnostic file can be downloaded from the run summary page under "Published Artifacts."
101
188
102
-
#### GitHub Actions
189
+
### GitHub Actions
103
190
104
191
Adding the `/DiagnosticsFile` parameter to the "arguments" field in the GitHub Action sql-action configuration causes the SqlPackage diagnostic information to be written to the file specified. Following the sql-action task, the diagnostic file can be made available outside of the virtual environment by publishing an artifact as seen in the following example.
In some scenarios, the current version of SqlPackage installed in the pipeline environment may be insufficient. If the environment can't be directly modified, an extra step can be used to install a newer version of SqlPackage during the pipeline run. It's important to run the install step before running any DacPac or BacPac operations in the pipeline. This task can be combined with a step to [check the version](#checking-the-sqlpackage-version) to ensure that the upgrade completed as expected.
127
-
128
-
#### Azure Pipelines
129
-
When the [PowerShell](/azure/devops/pipelines/tasks/utility/powershell) task is used in an Azure Pipeline, a step can be added to an Azure Pipeline that downloads the desired DacFx installer and installs it silently.
0 commit comments