-
Notifications
You must be signed in to change notification settings - Fork 161
Update hosting-sql-database-projects.md #2349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
795c1d7
Update hosting-sql-database-projects.md
jmezach ac1d539
Update docs/community-toolkit/hosting-sql-database-projects.md
jmezach cb24286
Update docs/community-toolkit/hosting-sql-database-projects.md
jmezach ab66f91
Update docs/community-toolkit/hosting-sql-database-projects.md
jmezach 7729a4c
Update docs/community-toolkit/hosting-sql-database-projects.md
jmezach e25d851
Update docs/community-toolkit/hosting-sql-database-projects.md
jmezach a9a24fe
Update docs/community-toolkit/hosting-sql-database-projects.md
IEvangelist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,36 @@ | |
|
||
Now when you run your .NET Aspire app host project you see the SQL Database Project being published to the specified SQL Server. | ||
|
||
## NuGet Package support | ||
|
||
Starting with version 9.2.0, you can deploy databases from referenced NuGet packages, such as those produced by [📦 MSBuild.Sdk.SqlProj](https://www.nuget.org/packages/MSBuild.Sdk.SqlProj) or [📦 Microsoft.Build.Sql](https://www.nuget.org/packages/Microsoft.Build.Sql). To deploy, add the NuGet package to your Aspire app host project, for example: | ||
|
||
```dotnetcli | ||
dotnet add package ErikEJ.Dacpac.Chinook | ||
``` | ||
|
||
Next, edit your project file to set the `IsAspirePackageResource` flag to `True` for the corresponding `PackageReference`, as shown in the following example: | ||
|
||
```xml | ||
<PackageReference Include="ErikEJ.Dacpac.Chinook" Version="1.0.0" | ||
IsAspirePackageResource="True" /> | ||
``` | ||
|
||
Finally, add the package as a resource to your app model: | ||
|
||
```csharp | ||
var builder = DistributedApplication.CreateBuilder(args); | ||
|
||
var sql = builder.AddSqlServer("sql") | ||
.AddDatabase("test"); | ||
|
||
builder.AddSqlPackage<Packages.ErikEJ_Dacpac_Chinook>("chinook") | ||
.WithReference(sql); | ||
``` | ||
|
||
> [!NOTE] | ||
> By default, the _.dacpac_ is expected to be located under _tools/<package-id>.dacpac_. In the preceding example, the _tools/ErikEJ.Dacpac.Chinook.dacpac_ path is expected. If for whatever reason the _.dacpac_ is under a different path within the package you can use `WithDacpac("relative/path/to/some.dacpac")` API to specify a path relative to the root of app host project directory. | ||
Check failure on line 94 in docs/community-toolkit/hosting-sql-database-projects.md
|
||
|
||
### Local .dacpac file support | ||
|
||
If you are sourcing your _.dacpac_ file from somewhere other than a project reference, you can also specify the path to the _.dacpac_ file directly: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.