Aspire SQL Projects
Use when
- Replacing ad-hoc SQL scripts with declarative schema management.
- Needing repeatable schema deployment in Aspire startup.
Workflow
- Add an SDK-style
.sqlprojusingMicrosoft.Build.Sqlfor new work. - Build with
dotnet build; the output artifact is a.dacpac. - Publish the
.dacpacwithSqlPackage /Action:Publishor an equivalent deployment task. - Model publish as an Aspire run-to-completion executable/container resource.
- Ensure DAB and tools
WaitForCompletionon the schema deployment resource.
Guardrails
- Use
WaitForCompletionfor run-to-completion schema tasks. - Do not assert a first-party
Aspire.Hosting.MSBuildSQL-project flow unless verified in current docs. - Keep SQL projects declarative: one source file per object; publish computes the target diff.
- Treat publish as a deployment step, not just a project reference.
- Keep DDL declarative and idempotency-aware where applicable.
Related skills
aspire-data-api-builderdata-api-builder-config
Microsoft Learn
- https://learn.microsoft.com/sql/tools/sql-database-projects/sql-database-projects
- https://learn.microsoft.com/dotnet/aspire/get-started/aspire-overview
Source: JerryNixon/data-api-builder-vscode-ext — distributed by TomeVault.