From cb05f3b89c773e3e4bde07733e08259a347543aa Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 14:16:43 -0500 Subject: [PATCH 01/12] docs: AddCSharpApp to AddDotnetProject migration guidance Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../get-started/add-aspire-existing-app.mdx | 12 +- .../dotnet/csharp-file-based-apps.mdx | 312 +++++++++++++----- .../integrations/dotnet/project-resources.mdx | 4 + .../frameworks/dotnet/dotnet-host.mdx | 1 + .../src/content/docs/whats-new/aspire-17.mdx | 21 +- 5 files changed, 254 insertions(+), 96 deletions(-) diff --git a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx index 2ec9b553d9..827aeaf867 100644 --- a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx +++ b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx @@ -159,6 +159,7 @@ Use a file-based AppHost when you want a lightweight single-file orchestrator wi ```bash title="Add hosting integrations" aspire add redis + aspire add Aspire.Hosting.Dotnet ``` 3. Wire the resources in `apphost.cs`: @@ -166,18 +167,17 @@ Use a file-based AppHost when you want a lightweight single-file orchestrator wi ```csharp title="apphost.cs" #:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% #:package Aspire.Hosting.Redis@%ASPIRE_VERSION% - - #pragma warning disable ASPIRECSHARPAPPS001 + #:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); - var api = builder.AddCSharpApp("api", "./src/Api/MyApp.Api.csproj") + var api = builder.AddDotnetProject("api", "./src/Api/MyApp.Api.csproj") .WithReference(cache) .WithHttpHealthCheck("/health"); - var worker = builder.AddCSharpApp("worker", "./src/Worker/MyApp.Worker.csproj") + var worker = builder.AddDotnetProject("worker", "./src/Worker/MyApp.Worker.csproj") .WithReference(cache); builder.Build().Run(); @@ -197,10 +197,6 @@ After setup, a typical repo layout looks like this: - MyApp.Worker.csproj -:::caution[AddCSharpApp is experimental] - is currently experimental. If you want details on limitations or diagnostic suppression, see [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/). -::: - #### Project-based AppHost (with a .sln) Use this approach when your repo is already a .NET solution (`.sln` or `.slnx`) with multiple projects. The project-based AppHost uses `ProjectReference` items and the generated `Projects` namespace for strongly-typed `AddProject()` calls, giving you full IDE support including IntelliSense, refactoring, and build-order awareness. diff --git a/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx b/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx index ff74c3cf3e..81c81d91f6 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx @@ -10,12 +10,6 @@ import LearnMore from '@components/LearnMore.astro'; import csharpIcon from '@assets/icons/csharp.svg'; import ApiReference from '@components/ApiReference.astro'; - - C# logo -This article is the reference for the Aspire C# file-based apps hosting integration. It enumerates the AppHost APIs — with examples for both `AppHost.cs` and `apphost.mts` — that you use to model C# file-based app resources in your [`AppHost`](/get-started/app-host/) project. +This article explains how to add C# file-based app resources to your [`AppHost`](/get-started/app-host/) with the stable `Aspire.Hosting.Dotnet` integration. The examples cover C#, TypeScript, and Go AppHosts. + +C# file-based applications let you run single `.cs` files without a `.csproj` project file. This feature, built on .NET 10 SDK's file-based app support, integrates directly with Aspire's orchestration. Use `AddDotnetProject` (`addDotnetProject` in TypeScript and Go AppHosts) to add a `.cs` file, `.csproj` file, or directory containing a project. + +Add the integration to your AppHost before using the examples: -C# file-based applications let you run single `.cs` files without a `.csproj` project file. This feature, built on .NET 10 SDK's file-based app support, integrates directly with Aspire's orchestration. Use `AddCSharpApp` (or `addCSharpApp` in TypeScript) to add these lightweight apps to your AppHost alongside traditional projects, containers, and executables. +```bash title="Terminal" +aspire add Aspire.Hosting.Dotnet +``` ## When to use file-based apps @@ -38,36 +38,62 @@ Use file-based apps when you need to: - Create lightweight APIs with minimal ceremony. - Experiment with Aspire integrations in a single file. -For production workloads or apps with multiple source files, use with a standard `.csproj` project instead. +For apps with multiple source files, use `AddDotnetProject` with a `.csproj` path. In a project-based AppHost that references the app project, you can also use . ## Add C# app resource -Call `AddCSharpApp` with a resource name and the relative path to a `.cs` file. The path is resolved relative to the AppHost directory: +Call `AddDotnetProject` with a resource name and the relative path to a `.cs` file. The path is resolved relative to the AppHost directory: + + +```typescript title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +await builder.addDotnetProject("worker", "../worker/Program.cs"); + +await builder.build().run(); +``` + + ```csharp title="AppHost.cs" -#pragma warning disable ASPIRECSHARPAPPS001 - var builder = DistributedApplication.CreateBuilder(args); -builder.AddCSharpApp("worker", "../worker/Program.cs"); +builder.AddDotnetProject("worker", "../worker/Program.cs"); builder.Build().Run(); ``` - + -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; +```go title="apphost.go" +package main -const builder = await createBuilder(); +import ( + "log" -await builder.addCSharpApp("worker", "../worker/Program.cs"); + "apphost/modules/aspire" +) -await builder.build().run(); +builder, err := aspire.CreateBuilder() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} + +builder.AddDotnetProject("worker", "../worker/Program.cs") + +app, err := builder.Build() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} +if err := app.Run(); err != nil { + log.Fatal(aspire.FormatError(err)) +} ``` @@ -76,44 +102,71 @@ await builder.build().run(); You can also point to a `.csproj` file or a directory that contains one: + + +```typescript title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +// Point to a .csproj file +await builder.addDotnetProject("api", "../api/Api.csproj"); + +// Point to a directory containing a .csproj file +await builder.addDotnetProject("frontend", "../frontend/"); + +await builder.build().run(); +``` + + ```csharp title="AppHost.cs" -#pragma warning disable ASPIRECSHARPAPPS001 - var builder = DistributedApplication.CreateBuilder(args); // Point to a .csproj file -builder.AddCSharpApp("api", "../api/Api.csproj"); +builder.AddDotnetProject("api", "../api/Api.csproj"); // Point to a directory containing a .csproj file -builder.AddCSharpApp("frontend", "../frontend/"); +builder.AddDotnetProject("frontend", "../frontend/"); builder.Build().Run(); ``` - + -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; +```go title="apphost.go" +package main -const builder = await createBuilder(); +import ( + "log" -// Point to a .csproj file -await builder.addCSharpApp("api", "../api/Api.csproj"); + "apphost/modules/aspire" +) -// Point to a directory containing a .csproj file -await builder.addCSharpApp("frontend", "../frontend/"); +builder, err := aspire.CreateBuilder() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} -await builder.build().run(); +builder.AddDotnetProject("api", "../api/Api.csproj") +builder.AddDotnetProject("frontend", "../frontend/") + +app, err := builder.Build() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} +if err := app.Run(); err != nil { + log.Fatal(aspire.FormatError(err)) +} ``` @@ -125,17 +178,35 @@ When pointing to a `.csproj` file or directory, `AddCSharpApp` behaves similarly File-based apps integrate fully with Aspire's resource model. You can reference other resources and configure service discovery just like any other project resource: + + +```typescript title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +const cache = await builder.addRedis("cache"); +const pg = await builder.addPostgres("pg"); +const db = await pg.addDatabase("mydb"); + +await builder.addDotnetProject("worker", "../worker/Program.cs") + .withReference(cache) + .withReference(db) + .withExternalHttpEndpoints(); + +await builder.build().run(); +``` + + ```csharp title="AppHost.cs" -#pragma warning disable ASPIRECSHARPAPPS001 - var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); var db = builder.AddPostgres("pg").AddDatabase("mydb"); -builder.AddCSharpApp("worker", "../worker/Program.cs") +builder.AddDotnetProject("worker", "../worker/Program.cs") .WithReference(cache) .WithReference(db) .WithExternalHttpEndpoints(); @@ -144,43 +215,72 @@ builder.Build().Run(); ``` - + -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; +```go title="apphost.go" +package main -const builder = await createBuilder(); +import ( + "log" -const cache = await builder.addRedis("cache"); -const pg = await builder.addPostgres("pg"); -const db = await pg.addDatabase("mydb"); + "apphost/modules/aspire" +) -await builder.addCSharpApp("worker", "../worker/Program.cs") - .withReference(cache) - .withReference(db) - .withExternalHttpEndpoints(); +builder, err := aspire.CreateBuilder() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} -await builder.build().run(); +cache := builder.AddRedis("cache") +db := builder.AddPostgres("pg").AddDatabase("mydb") + +worker := builder.AddDotnetProject("worker", "../worker/Program.cs") +worker.WithReference(cache) +worker.WithReference(db) +worker.WithExternalHttpEndpoints() + +app, err := builder.Build() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} +if err := app.Run(); err != nil { + log.Fatal(aspire.FormatError(err)) +} ``` -The file-based app receives connection strings and service discovery information through environment variables, exactly like projects added with `AddProject` (or `addProject`). +The file-based app receives connection strings and service discovery information through environment variables, like other resources added with `AddDotnetProject`. ## Configure options -The C# `AddCSharpApp` method accepts an optional `Action` callback to configure launch settings: +`AddDotnetProject` accepts optional launch settings. The following example sets the launch profile and disables automatic endpoint inference from the launch profile and Kestrel configuration: + + +```typescript title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +await builder.addDotnetProject("api", "../api/Api.cs", { + launchProfileName: "https", + excludeLaunchProfile: false, + excludeKestrelEndpoints: false, +}); + +await builder.build().run(); +``` + + ```csharp title="AppHost.cs" -#pragma warning disable ASPIRECSHARPAPPS001 - var builder = DistributedApplication.CreateBuilder(args); -builder.AddCSharpApp("api", "../api/Api.cs", options => +builder.AddDotnetProject("api", "../api/Api.cs", options => { options.LaunchProfileName = "https"; options.ExcludeLaunchProfile = false; @@ -191,12 +291,36 @@ builder.Build().Run(); ``` - - -:::note -The TypeScript `addCSharpApp` API accepts a `ProjectResourceOptions` object via the `options` field, but creating and configuring that object from TypeScript is not yet directly supported. Launch profile customization for C# file-based apps is currently a C#-only feature. -::: - + + +```go title="apphost.go" +package main + +import ( + "log" + + "apphost/modules/aspire" +) + +builder, err := aspire.CreateBuilder() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} + +builder.AddDotnetProject("api", "../api/Api.cs", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{ + LaunchProfileName: aspire.StringPtr("https"), + ExcludeLaunchProfile: aspire.BoolPtr(false), + ExcludeKestrelEndpoints: aspire.BoolPtr(false), +})) + +app, err := builder.Build() +if err != nil { + log.Fatal(aspire.FormatError(err)) +} +if err := app.Run(); err != nil { + log.Fatal(aspire.FormatError(err)) +} +``` @@ -215,14 +339,13 @@ You can also write the AppHost itself as a file-based C# app using the `#:sdk` d ```csharp title="apphost.cs" #:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% #:package Aspire.Hosting.Redis@%ASPIRE_VERSION% - -#pragma warning disable ASPIRECSHARPAPPS001 +#:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -builder.AddCSharpApp("worker", "../worker/Program.cs") +builder.AddDotnetProject("worker", "../worker/Program.cs") .WithReference(cache); builder.Build().Run(); @@ -240,7 +363,7 @@ A TypeScript AppHost (`apphost.mts`) is already a file-based script with no proj ## IDE debugging behavior -Visual Studio can only launch programs that are loaded as projects in the solution. A file-based `.cs` resource added with `AddCSharpApp` isn't a loaded project, so when the AppHost runs under a Visual Studio debug session, Aspire runs the file-based app as a plain process (`dotnet run --file`) instead of handing it to the IDE. The resource still starts and joins the AppHost's resource graph — it just doesn't get IDE-managed debugging in that scenario. +Visual Studio can only launch programs that are loaded as projects in the solution. A file-based `.cs` resource isn't a loaded project, so when the AppHost runs under a Visual Studio debug session, Aspire runs the file-based app as a plain process (`dotnet run --file`) instead of handing it to the IDE. The resource still starts and joins the AppHost's resource graph — it just doesn't get IDE-managed debugging in that scenario. The Visual Studio Code extension explicitly advertises support for launching file-based apps, so file-based resources debug normally when the AppHost runs under VS Code. @@ -250,52 +373,67 @@ The Visual Studio Code extension explicitly advertises support for launching fil ## Limitations -Since this feature is experimental, be aware of the following limitations: +Be aware of the following limitations: -- **Experimental status** — the API is marked with `[Experimental("ASPIRECSHARPAPPS001")]` and may change in future releases. - **Single-file only** — file-based apps are limited to a single `.cs` file per resource. - **.NET 10 SDK required** — file-based app execution requires the .NET 10 SDK or later. -- **No deployment support** — file-based apps are designed for local development scenarios. +- **No publishing support** — `AddDotnetProject` resources don't currently support `aspire publish` or `aspire deploy`. -## Suppress the diagnostic +## Migrating from AddCSharpApp -To use `AddCSharpApp` in a C# AppHost, suppress the `ASPIRECSHARPAPPS001` diagnostic using one of these methods: +Starting in Aspire 17.0, `AddCSharpApp` and the polyglot `addCSharpApp` export are obsolete. Existing C# calls now produce the `CS0618` compiler warning instead of the `ASPIRECSHARPAPPS001` experimental error, and the TypeScript API surface emits `@deprecated` instead of `@experimental`. Signatures, defaults, validation, callbacks, path handling, and launch/publish behavior are unchanged for existing `AddCSharpApp` calls — only the diagnostic metadata changed. -**In code** with a pragma directive: +Add the [📦 Aspire.Hosting.Dotnet](https://www.nuget.org/packages/Aspire.Hosting.Dotnet) integration and replace `AddCSharpApp` / `addCSharpApp` calls with `AddDotnetProject` / `addDotnetProject`: -```csharp title="AppHost.cs" -#pragma warning disable ASPIRECSHARPAPPS001 -builder.AddCSharpApp("worker", "../worker/Program.cs"); -#pragma warning restore ASPIRECSHARPAPPS001 +```bash title="Terminal" +aspire add Aspire.Hosting.Dotnet ``` -**In your project file** with `NoWarn`: + + -```xml title="C# project file" - - $(NoWarn);ASPIRECSHARPAPPS001 - +```typescript title="apphost.mts" +await builder.addDotnetProject("worker", "../worker/Program.cs"); ``` -**In an _.editorconfig_ file**: + + -```ini title=".editorconfig" -[*.{cs,vb}] -dotnet_diagnostic.ASPIRECSHARPAPPS001.severity = none +```csharp title="AppHost.cs" +builder.AddDotnetProject("worker", "../worker/Program.cs"); ``` -:::note -`ASPIRECSHARPAPPS001` is a C# compiler diagnostic. TypeScript AppHosts call `addCSharpApp` without any diagnostic suppression needed. -::: + + + +```go title="apphost.go" +builder.AddDotnetProject("worker", "../worker/Program.cs") +``` + + + + +`AddDotnetProject` accepts the same kinds of paths — a `.cs` file, a `.csproj` file, or a directory containing a single `.csproj` — but returns a `DotnetProjectResource` instead of a `ProjectResource` / `CSharpAppResource`. Explicitly typed resource builders and project-specific customizations might need updating. The legacy API still supports automatic publishing. If you rely on `aspire publish` or `aspire deploy` for this resource, keep the existing call for now; `DotnetProjectResource` doesn't yet support publishing. + +If you keep using `AddCSharpApp` and treat warnings as errors, suppress `CS0618` for the retained calls: + +```csharp title="AppHost.cs" +#pragma warning disable CS0618 +builder.AddCSharpApp("worker", "../worker/Program.cs"); +#pragma warning restore CS0618 +``` - Learn more about [ASPIRECSHARPAPPS001](/diagnostics/aspirecsharpapps001/). + See [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) + for the full `AddDotnetProject` reference, and + [What's new in Aspire 17.0](/whats-new/aspire-17/#breaking-changes) for the + obsoletion announcement. ## See also - [What is the AppHost?](/get-started/app-host/) -- [Compiler Error ASPIRECSHARPAPPS001](/diagnostics/aspirecsharpapps001/) +- [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) - [Project resources](/integrations/dotnet/project-resources/) - [Aspire SDK](/get-started/aspire-sdk/) - [Executable resources](/app-host/executable-resources/) diff --git a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx index dc94a4ec12..529591ab70 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx @@ -666,6 +666,10 @@ micro2 := builder.AddDotnetProject("micro2", "../Microservice2/Presentation.Api/ ## AddProject vs. AddCSharpApp +:::note +`AddCSharpApp` is obsolete starting in Aspire 17.0. Use [`AddDotnetProject`](/integrations/frameworks/dotnet/dotnet-host/) from `Aspire.Hosting.Dotnet` for new path-based project or file-based app resources instead. See [Migrating to AddDotnetProject](/integrations/dotnet/csharp-file-based-apps/#migrating-to-adddotnetproject). +::: + In a **C# AppHost**, use `AddProject` when you have a standard `.csproj`, can add a `ProjectReference` from the AppHost, and want generated `Projects.*` types plus launch-profile integration. Use `AddCSharpApp` when you want to run a single `.cs` file, or when you want to point at a project path directly without adding a `ProjectReference` from the AppHost. In a **TypeScript AppHost**, `addProject(name, path)` always takes a path, so the distinction between `AddProject` and `AddCSharpApp` doesn't apply in the same way. diff --git a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx index cc6e7dc0d5..bcd8d156c5 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx @@ -28,6 +28,7 @@ If you're new to the Dotnet integration, start with the [Get started with the .N Starting with Aspire 17.0, `Aspire.Hosting.Dotnet` is a stable package that follows Aspire's normal stable versioning. Existing experimental integration-authoring APIs still require you to suppress [`ASPIREPROJECTS001`](/diagnostics/aspireprojects001/), and other experimental features, such as watch support, remain experimental. Starting with Aspire 13.6, , `DotnetProjectResource`, and the related overloads no longer require suppressing [`ASPIREDOTNETPROJECT001`](/diagnostics/aspiredotnetproject001/). You can remove existing suppressions for these APIs after upgrading. +Starting with Aspire 17.0, `AddCSharpApp` / `addCSharpApp` is obsolete. If you're migrating existing `AddCSharpApp` calls to this integration, see [Migrating to AddDotnetProject](/integrations/dotnet/csharp-file-based-apps/#migrating-to-adddotnetproject). ::: If your C# AppHost needs to reference the resource type directly — for example, to declare a strongly typed variable or a method parameter — import it from the `Aspire.Hosting.Dotnet` namespace, matching the pattern used by the Go, Python, and JavaScript hosting integrations: diff --git a/src/frontend/src/content/docs/whats-new/aspire-17.mdx b/src/frontend/src/content/docs/whats-new/aspire-17.mdx index 306cba3280..936a0c2659 100644 --- a/src/frontend/src/content/docs/whats-new/aspire-17.mdx +++ b/src/frontend/src/content/docs/whats-new/aspire-17.mdx @@ -387,7 +387,7 @@ Without an explicit override, publishers resolve the dashboard tag from the Aspi | Legacy `Aspire.RabbitMQ.Client.v6` and `Aspire.MongoDB.Driver.v2` packages removed | Switch to `Aspire.RabbitMQ.Client` and `Aspire.MongoDB.Driver`, and migrate to the 7.x and 3.x client libraries. | | Azure Cosmos DB `configureClientOptions` now receives `IServiceProvider` | Add the service-provider parameter to callbacks and rebuild binaries that call these methods. | | Docker Swarm `UpdateConfig.MaxFailureRatio` changed from `string?` to `double?` | Assign a number such as `0.3` instead of a string such as `"0.3"`. | - +| `AddCSharpApp` is obsolete and reports `CS0618` instead of `ASPIRECSHARPAPPS001` | Add `Aspire.Hosting.Dotnet` and replace calls with `AddDotnetProject`. | ### `ResourceUrlAnnotation.DisplayOrder` is now a property `DisplayOrder` changed from an obsolete public field to a read/write property. Its behavior is unchanged: higher values display higher in the dashboard URL list. @@ -449,3 +449,22 @@ Change string assignments to numeric assignments: For details, see [microsoft/aspire#21512](https://github.com/microsoft/aspire/pull/21512). +### `AddCSharpApp` is obsolete + +`AddCSharpApp` (and the polyglot `addCSharpApp` export) was previously experimental. Starting in Aspire 17.0, it's marked `[Obsolete]` instead of `[Experimental("ASPIRECSHARPAPPS001")]`. Existing calls now produce the compiler warning `CS0618` instead of the `ASPIRECSHARPAPPS001` error, and the TypeScript API surface emits `@deprecated` instead of `@experimental`. + +Add the [📦 Aspire.Hosting.Dotnet](https://www.nuget.org/packages/Aspire.Hosting.Dotnet) integration and replace calls with `AddDotnetProject` (`addDotnetProject` in TypeScript): + +```csharp title="AppHost.cs" del={1} ins={2} +builder.AddCSharpApp("api", "./api/api.cs"); +builder.AddDotnetProject("api", "./api/api.cs"); +``` + +`AddDotnetProject` accepts the same kinds of paths (a `.cs` file, a `.csproj` file, or a directory containing a single `.csproj`) but returns a `DotnetProjectResource` rather than a `ProjectResource` or `CSharpAppResource`. Explicitly typed resource builders and project-specific customizations might need updating. Existing `AddCSharpApp` calls keep their current launch and publishing behavior; if you treat warnings as errors, suppress `CS0618` until you migrate. + + + See [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/#migrating-to-adddotnetproject) + for migration guidance. For the obsoletion details, see + [microsoft/aspire#20825](https://github.com/microsoft/aspire/pull/20825). + + From d48b3a5639b53e4f817bb817305827cd0f36ef1b Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 14:23:33 -0500 Subject: [PATCH 02/12] docs: correct dotnet project publishing guidance Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../docs/integrations/dotnet/csharp-file-based-apps.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx b/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx index 81c81d91f6..bd7f8929fa 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx @@ -377,7 +377,6 @@ Be aware of the following limitations: - **Single-file only** — file-based apps are limited to a single `.cs` file per resource. - **.NET 10 SDK required** — file-based app execution requires the .NET 10 SDK or later. -- **No publishing support** — `AddDotnetProject` resources don't currently support `aspire publish` or `aspire deploy`. ## Migrating from AddCSharpApp @@ -413,7 +412,7 @@ builder.AddDotnetProject("worker", "../worker/Program.cs") -`AddDotnetProject` accepts the same kinds of paths — a `.cs` file, a `.csproj` file, or a directory containing a single `.csproj` — but returns a `DotnetProjectResource` instead of a `ProjectResource` / `CSharpAppResource`. Explicitly typed resource builders and project-specific customizations might need updating. The legacy API still supports automatic publishing. If you rely on `aspire publish` or `aspire deploy` for this resource, keep the existing call for now; `DotnetProjectResource` doesn't yet support publishing. +`AddDotnetProject` accepts the same kinds of paths — a `.cs` file, a `.csproj` file, or a directory containing a single `.csproj` — but returns a `DotnetProjectResource` instead of a `ProjectResource` / `CSharpAppResource`. Explicitly typed resource builders and project-specific customizations might need updating. Resources added with `AddDotnetProject` are configured for .NET SDK container publishing automatically. If you keep using `AddCSharpApp` and treat warnings as errors, suppress `CS0618` for the retained calls: From 224aa526b33333d264bf78916277c4a55e61762b Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 16:20:00 -0500 Subject: [PATCH 03/12] docs: add DotnetProjectResource migration guide and AppHost SDK removal - Add migration guide for AddProject/AddCSharpApp to AddDotnetProject - Add ASPIRE012 diagnostic and remove obsolete Aspire.AppHost.Sdk guidance - Make dotnet-host and related pages evergreen with Aspire 17 pointers Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/frontend/config/sidebar/docs.topics.ts | 2 +- .../config/sidebar/integrations.topics.ts | 4 + .../config/sidebar/reference.topics.ts | 1 + .../content/docs/app-host/configuration.mdx | 14 +- .../docs/dashboard/terminal-tape-playback.mdx | 2 +- .../content/docs/diagnostics/aspire007.mdx | 4 + .../content/docs/diagnostics/aspire008.mdx | 12 +- .../content/docs/diagnostics/aspire009.mdx | 2 +- .../content/docs/diagnostics/aspire012.mdx | 80 +++++ .../docs/diagnostics/aspirecsharpapps001.mdx | 6 + .../src/content/docs/diagnostics/overview.mdx | 1 + .../get-started/add-aspire-existing-app.mdx | 45 ++- .../content/docs/get-started/aspire-sdk.mdx | 101 +++---- .../docs/get-started/what-is-aspire.mdx | 7 +- .../hosting-integrations.mdx | 2 +- .../databases/efcore/seed-database.mdx | 8 +- .../dotnet/csharp-file-based-apps.mdx | 79 +---- .../integrations/dotnet/launch-profiles.mdx | 90 +++++- .../migrate-dotnet-project-resource.mdx | 286 ++++++++++++++++++ .../integrations/dotnet/project-resources.mdx | 6 +- .../frameworks/dotnet/dotnet-host.mdx | 116 +++---- .../reference/cli/commands/aspire-init.mdx | 4 +- .../src/content/docs/whats-new/aspire-17.mdx | 8 +- .../content/docs/whats-new/upgrade-aspire.mdx | 10 + 24 files changed, 628 insertions(+), 262 deletions(-) create mode 100644 src/frontend/src/content/docs/diagnostics/aspire012.mdx create mode 100644 src/frontend/src/content/docs/integrations/dotnet/migrate-dotnet-project-resource.mdx diff --git a/src/frontend/config/sidebar/docs.topics.ts b/src/frontend/config/sidebar/docs.topics.ts index aadb057d41..2af25b4f42 100644 --- a/src/frontend/config/sidebar/docs.topics.ts +++ b/src/frontend/config/sidebar/docs.topics.ts @@ -1016,7 +1016,7 @@ export const docsTopics = { collapsed: false, items: [ { - label: 'Aspire SDK', + label: 'AppHost project configuration', slug: 'get-started/aspire-sdk', }, { diff --git a/src/frontend/config/sidebar/integrations.topics.ts b/src/frontend/config/sidebar/integrations.topics.ts index 6661fe9b55..e599e18f7e 100644 --- a/src/frontend/config/sidebar/integrations.topics.ts +++ b/src/frontend/config/sidebar/integrations.topics.ts @@ -1519,6 +1519,10 @@ export const integrationTopics: StarlightSidebarTopicsUserConfig = { { label: 'Project resources', slug: 'integrations/dotnet/project-resources' }, { label: 'C# file-based apps', slug: 'integrations/dotnet/csharp-file-based-apps' }, { label: 'Launch profiles', slug: 'integrations/dotnet/launch-profiles' }, + { + label: 'Migrate to DotnetProjectResource', + slug: 'integrations/dotnet/migrate-dotnet-project-resource', + }, { label: '.NET tool resources', slug: 'integrations/dotnet/dotnet-tool-resources' }, { label: 'Blazor', diff --git a/src/frontend/config/sidebar/reference.topics.ts b/src/frontend/config/sidebar/reference.topics.ts index c6911fdaef..97e501997a 100644 --- a/src/frontend/config/sidebar/reference.topics.ts +++ b/src/frontend/config/sidebar/reference.topics.ts @@ -693,6 +693,7 @@ export const referenceTopics: StarlightSidebarTopicsUserConfig[number] = { { label: 'ASPIRE003', link: '/diagnostics/aspire003' }, { label: 'ASPIRE004', link: '/diagnostics/aspire004' }, { label: 'ASPIRE010', link: '/diagnostics/aspire010' }, + { label: 'ASPIRE012', link: '/diagnostics/aspire012' }, { label: 'ASPIREEXPORT005', link: '/diagnostics/aspireexport005', diff --git a/src/frontend/src/content/docs/app-host/configuration.mdx b/src/frontend/src/content/docs/app-host/configuration.mdx index 4df8ef4f80..026f681f5f 100644 --- a/src/frontend/src/content/docs/app-host/configuration.mdx +++ b/src/frontend/src/content/docs/app-host/configuration.mdx @@ -159,7 +159,7 @@ The version check runs only when: - The check hasn't been disabled via the `ASPIRE_VERSION_CHECK_DISABLED` configuration setting. - The app is not running in publish mode. -Updates are manual. You need to edit your project file to upgrade the Aspire SDK and package versions. +Update the Aspire CLI with `aspire update --self`, then run `aspire update` to update the AppHost's Aspire package versions. You can also edit the package versions manually. ## Resource service @@ -207,7 +207,7 @@ Internal settings are used by the AppHost and integrations. Internal settings ar ## Advanced orchestration properties ### DcpCliPath @@ -216,11 +216,7 @@ The `DcpCliPath` property specifies the path to the **Developer Control Plane (D #### How it works -When you use the [Aspire SDK](/get-started/aspire-sdk/), the build system automatically: - -1. Imports the platform-specific `Aspire.Hosting.Orchestration` NuGet package (for example, `Aspire.Hosting.Orchestration.win-x64`). -2. Sets `DcpCliPath` to point to the `dcp` executable within that package. -3. Embeds this path as assembly metadata in your compiled AppHost. +The AppHost build resolves DCP from the installed [Aspire CLI bundle](/get-started/aspire-sdk/#use-the-aspire-cli-bundle-for-orchestration-dependencies), which C# AppHosts require, and embeds its path as assembly metadata in your compiled AppHost. When you start the AppHost with `aspire run` or `aspire start`, the CLI passes the bundle paths to the AppHost directly. At runtime, the AppHost reads this metadata to locate and start the DCP process, which then orchestrates your application's resources. @@ -239,9 +235,9 @@ In rare cases, you may need to override the default DCP path: You might override `DcpCliPath` in these scenarios: - **Aspire contributors**: Testing with a custom or debug build of DCP when developing Aspire itself. -- **CI/CD pipelines**: Non-standard SDK layouts where automatic discovery doesn't work. +- **CI/CD pipelines**: Nonstandard layouts where automatic discovery doesn't work. - **Troubleshooting**: Temporarily pointing to a specific DCP version to diagnose issues. diff --git a/src/frontend/src/content/docs/dashboard/terminal-tape-playback.mdx b/src/frontend/src/content/docs/dashboard/terminal-tape-playback.mdx index 4778380a21..da31e375d2 100644 --- a/src/frontend/src/content/docs/dashboard/terminal-tape-playback.mdx +++ b/src/frontend/src/content/docs/dashboard/terminal-tape-playback.mdx @@ -23,7 +23,7 @@ This example runs an interactive Bash shell in your own AppHost and doesn't requ ### Set up the shell resource -Use an existing AppHost or [create one with `aspire init`](/reference/cli/commands/aspire-init/). Replace its application code with the following complete example. For a file-based C# AppHost, retain the generated `#:sdk` and `#:package` directives above the code. +Use an existing AppHost or [create one with `aspire init`](/reference/cli/commands/aspire-init/). Replace its application code with the following complete example. For a file-based C# AppHost, retain the generated `#:package` directives above the code. diff --git a/src/frontend/src/content/docs/diagnostics/aspire007.mdx b/src/frontend/src/content/docs/diagnostics/aspire007.mdx index d6a6a1eb28..24c85a983e 100644 --- a/src/frontend/src/content/docs/diagnostics/aspire007.mdx +++ b/src/frontend/src/content/docs/diagnostics/aspire007.mdx @@ -17,6 +17,10 @@ import { Badge } from '@astrojs/starlight/components'; The Aspire AppHost package references require Aspire SDK version 9.0.0 or greater. The SDK reference is either being omitted or is using a version older than 9.0.0. +:::note[Aspire 17 and later] +Starting with Aspire 17, C# AppHosts don't use `Aspire.AppHost.Sdk`. If you see this error in an Aspire 17 AppHost, don't add the SDK back. Instead, make sure the AppHost uses `Microsoft.NET.Sdk` with `Aspire.Hosting.AppHost` and `Aspire.Hosting.Dotnet` package references at the same version. For more information, see [C# AppHost project configuration](/get-started/aspire-sdk/). +::: + ## To correct this error Update the referenced SDK version to 9.0.0 or the latest. diff --git a/src/frontend/src/content/docs/diagnostics/aspire008.mdx b/src/frontend/src/content/docs/diagnostics/aspire008.mdx index d5cab84071..0bfaf30684 100644 --- a/src/frontend/src/content/docs/diagnostics/aspire008.mdx +++ b/src/frontend/src/content/docs/diagnostics/aspire008.mdx @@ -17,7 +17,7 @@ This error appears when an Aspire AppHost project has `GenerateAssemblyInfo` set The following AppHost project file has `GenerateAssemblyInfo` disabled, which causes `ASPIRE008`: ```xml title="C# project file" - + Exe @@ -28,6 +28,10 @@ The following AppHost project file has `GenerateAssemblyInfo` disabled, which ca false + + + + ``` @@ -36,7 +40,7 @@ The following AppHost project file has `GenerateAssemblyInfo` disabled, which ca Remove the `false` line from your project file, or set it to `true`: ```xml title="C# project file" - + Exe @@ -46,6 +50,10 @@ Remove the `false` line from your p 98048c9c-bf28-46ba-a98e-63767ee5e3a8 + + + + ``` diff --git a/src/frontend/src/content/docs/diagnostics/aspire009.mdx b/src/frontend/src/content/docs/diagnostics/aspire009.mdx index 25625f8e42..5c55a1f94a 100644 --- a/src/frontend/src/content/docs/diagnostics/aspire009.mdx +++ b/src/frontend/src/content/docs/diagnostics/aspire009.mdx @@ -15,7 +15,7 @@ import { Badge } from '@astrojs/starlight/components'; > '[ProjectName]' is configured to use the Aspire CLI bundle, but the bundle could not be resolved. -This diagnostic error is reported when an AppHost project opts in to the Aspire CLI bundle (`AspireUseCliBundle=true`) but the SDK can't resolve a usable bundle layout for the developer control plane (DCP) and the Aspire Dashboard. +This diagnostic error is reported when an AppHost project opts in to the Aspire CLI bundle (`AspireUseCliBundle=true`) but the AppHost build can't resolve a usable bundle layout for the developer control plane (DCP) and the Aspire Dashboard. When neither `AspireCliPath` nor `AspireCliBundlePath` is set, a usable `dnx` host can resolve or prepare the required bundle layout through the selected Aspire CLI package. Therefore, a missing `aspire` command alone doesn't cause `ASPIRE009`. Explicit paths are authoritative: an invalid `AspireCliPath` or `AspireCliBundlePath` causes `ASPIRE009` even when `dnx` is available. diff --git a/src/frontend/src/content/docs/diagnostics/aspire012.mdx b/src/frontend/src/content/docs/diagnostics/aspire012.mdx new file mode 100644 index 0000000000..9913757198 --- /dev/null +++ b/src/frontend/src/content/docs/diagnostics/aspire012.mdx @@ -0,0 +1,80 @@ +--- +title: Compiler Warning ASPIRE012 +seoTitle: 'ASPIRE012: Aspire.AppHost.Sdk is obsolete · Aspire' +description: Learn why Aspire.AppHost.Sdk reports warning ASPIRE012 in Aspire 17, how to move a C# AppHost to Microsoft.NET.Sdk, and how to suppress the warning. +--- + +import { Badge } from '@astrojs/starlight/components'; + + + +> '[ProjectName]' uses the Aspire.AppHost.Sdk, which is obsolete but remains available for staged migration. Switch the project's Sdk attribute to Microsoft.NET.Sdk, add explicit PackageReference items for Aspire.Hosting.AppHost and Aspire.Hosting.Dotnet, and migrate C# resource ProjectReference items to AddDotnetProject calls. See https://aka.ms/aspire/diagnostics/aspire012 for migration guidance. + +This diagnostic warning is reported when a C# AppHost uses `Aspire.AppHost.Sdk`, either in a project file's `Sdk` attribute or in a file-based app's `#:sdk` directive. The SDK still works, including AppHost project references and `AddProject` resources, so you can migrate in stages. + +C# AppHosts now use `Microsoft.NET.Sdk` with explicit `Aspire.Hosting.AppHost` and `Aspire.Hosting.Dotnet` packages, and add .NET projects with `AddDotnetProject`. Running `aspire update` doesn't remove the SDK for you. + +## Example + +The following project file produces `ASPIRE012`: + +```xml title="MyApp.AppHost.csproj" + +``` + +The following file-based AppHost directive also produces `ASPIRE012`: + +```csharp title="apphost.cs" +#:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% +``` + +## To correct this warning + +Replace the SDK with `Microsoft.NET.Sdk` and explicit package references: + +```xml title="MyApp.AppHost.csproj" + + + + + + + + + + +``` + +In a file-based AppHost, replace the `#:sdk` directive with package directives: + +```csharp title="apphost.cs" +#:package Aspire.Hosting.AppHost@%ASPIRE_VERSION% +#:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% +``` + +Then review the AppHost's project references. Without the SDK, project references no longer generate `Projects.*` metadata automatically. Migrate resources to `AddDotnetProject`, or mark references that legacy APIs still need. For complete steps, see [Remove the obsolete AppHost SDK](/integrations/dotnet/migrate-dotnet-project-resource/#remove-the-obsolete-apphost-sdk). + +## Suppress the warning + +Suppress `ASPIRE012` only temporarily while you migrate. Set the following property in the AppHost project file: + +```xml title="MyApp.AppHost.csproj" + + true + +``` + +Alternatively, add `ASPIRE012` to `NoWarn`: + +```xml title="MyApp.AppHost.csproj" + + $(NoWarn);ASPIRE012 + +``` + +Suppressing `ASPIRE012` doesn't suppress `CS0618` warnings for obsolete resource APIs such as `AddProject`, and doesn't remove the [Aspire CLI bundle requirement](/diagnostics/aspire013/). diff --git a/src/frontend/src/content/docs/diagnostics/aspirecsharpapps001.mdx b/src/frontend/src/content/docs/diagnostics/aspirecsharpapps001.mdx index d8aa51a8fd..f6104c19e8 100644 --- a/src/frontend/src/content/docs/diagnostics/aspirecsharpapps001.mdx +++ b/src/frontend/src/content/docs/diagnostics/aspirecsharpapps001.mdx @@ -24,6 +24,12 @@ After you upgrade, remove any `ASPIRECSHARPAPPS001` suppressions from _.editorco Aspire provides a way to add C# app resources to the Aspire AppHost with the `AddCSharpApp` extension. This allows you to reference C# file-based app files (.cs), project files (.csproj), or project directories (directories containing a .csproj file) directly without needing a `ProjectReference` from the AppHost project to the C# application. Since the shape of this API is expected to change in the future, it's experimental. +:::note[Aspire 17 and later] +Starting in Aspire 17, `AddCSharpApp` is obsolete and reports the `CS0618` compiler warning instead of `ASPIRECSHARPAPPS001`. Rather than suppressing either diagnostic, replace the call with `AddDotnetProject`. See [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). +::: + +The rest of this article applies to Aspire versions before 17. + ## Example The following code generates `ASPIRECSHARPAPPS001`: diff --git a/src/frontend/src/content/docs/diagnostics/overview.mdx b/src/frontend/src/content/docs/diagnostics/overview.mdx index fee46cca7b..dac2b0dafa 100644 --- a/src/frontend/src/content/docs/diagnostics/overview.mdx +++ b/src/frontend/src/content/docs/diagnostics/overview.mdx @@ -20,6 +20,7 @@ The following table lists the possible MSBuild and analyzer warnings and errors | [ASPIRE009](/diagnostics/aspire009/) | Error | 'Project' is configured to use the Aspire CLI bundle, but the bundle could not be resolved. | | [ASPIRE010](/diagnostics/aspire010/) | Warning | 'Project' is configured with AspireUseCliBundle=false. Some Aspire features require the Aspire CLI bundle. | | [ASPIRE011](/diagnostics/aspire011/) | Error | 'Project' is configured to invoke the Aspire CLI through DNX, but the dnx command could not be found on PATH. | +| [ASPIRE012](/diagnostics/aspire012/) | Warning | 'Project' uses the Aspire.AppHost.Sdk, which is obsolete but remains available for staged migration. | | [ASPIRE013](/diagnostics/aspire013/) | Error | 'Project' requires the Aspire CLI bundle. Remove AspireUseCliBundle or set it to true. | | [ASPIREACADOMAINS001](/diagnostics/aspireacadomains001/) | (Experimental) Error | is for evaluation purposes only and is subject to change or removal in future updates. | | [ASPIREACAEXPRESS001](/diagnostics/aspireacaexpress001/) | (Experimental) Error | is for evaluation purposes only and is subject to change or removal in future updates. | diff --git a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx index 827aeaf867..8a21f81c33 100644 --- a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx +++ b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx @@ -103,11 +103,11 @@ The AppHost is the orchestration layer. Your choice here changes how you express Aspire offers two C# AppHost styles: -**File-based AppHost** — a single `apphost.cs` file that uses `#:sdk` and `#:package` directives. No `.csproj`, no solution integration required. Best for repos with [polyglot](/get-started/glossary/#polyglot) code or quick setups. +**File-based AppHost** — a single `apphost.cs` file that uses `#:package` directives. No `.csproj`, no solution integration required. Best for repos with [polyglot](/get-started/glossary/#polyglot) code or quick setups. -**Project-based AppHost** — a traditional `AppHost.csproj` that lives inside a `.sln` alongside your other C# projects. Uses `ProjectReference` items and the generated `Projects` namespace for strongly-typed calls. Best when your repo is already a .NET solution and you want IDE-integrated orchestration. +**Project-based AppHost** — a traditional `AppHost.csproj` that lives inside a `.sln` alongside your other C# projects. Best when your repo is already a .NET solution and you want IDE-integrated orchestration. -Both styles use the same `Aspire.AppHost.Sdk` and the same hosting APIs. +Both styles use the same [AppHost packages](/get-started/aspire-sdk/) and hosting APIs, and both add .NET projects by path with `AddDotnetProject`. @@ -165,7 +165,7 @@ Use a file-based AppHost when you want a lightweight single-file orchestrator wi 3. Wire the resources in `apphost.cs`: ```csharp title="apphost.cs" - #:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% + #:package Aspire.Hosting.AppHost@%ASPIRE_VERSION% #:package Aspire.Hosting.Redis@%ASPIRE_VERSION% #:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% @@ -199,7 +199,7 @@ After setup, a typical repo layout looks like this: #### Project-based AppHost (with a .sln) -Use this approach when your repo is already a .NET solution (`.sln` or `.slnx`) with multiple projects. The project-based AppHost uses `ProjectReference` items and the generated `Projects` namespace for strongly-typed `AddProject()` calls, giving you full IDE support including IntelliSense, refactoring, and build-order awareness. +Use this approach when your repo is already a .NET solution (`.sln` or `.slnx`) with multiple projects. The project-based AppHost joins your solution, so you get full IDE support including IntelliSense, debugging, and refactoring. @@ -209,24 +209,17 @@ Use this approach when your repo is already a .NET solution (`.sln` or `.slnx`) aspire init ``` -2. Add project references from the AppHost to each service you want to orchestrate: - - ```bash title="Add project references" - dotnet add MyApp.AppHost reference src/Api/MyApp.Api.csproj - dotnet add MyApp.AppHost reference src/Web/MyApp.Web.csproj - dotnet add MyApp.AppHost reference src/Worker/MyApp.Worker.csproj - ``` - -3. Add hosting integrations: +2. Add hosting integrations: ```bash title="Add hosting integrations" aspire add redis aspire add postgres + aspire add Aspire.Hosting.Dotnet ``` -4. Wire the resources in the AppHost's `Program.cs`: +3. Wire the resources in the AppHost's `AppHost.cs`, referencing each service by its project path: - ```csharp title="MyApp.AppHost/Program.cs" + ```csharp title="MyApp.AppHost/AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") @@ -236,16 +229,16 @@ Use this approach when your repo is already a .NET solution (`.sln` or `.slnx`) .WithLifetime(ContainerLifetime.Persistent) .AddDatabase("mydb"); - var api = builder.AddProject("api") + var api = builder.AddDotnetProject("api", "../src/Api/MyApp.Api.csproj") .WithReference(db) .WithReference(cache) .WaitFor(db); - builder.AddProject("web") + builder.AddDotnetProject("web", "../src/Web/MyApp.Web.csproj") .WithReference(api) .WaitFor(api); - builder.AddProject("worker") + builder.AddDotnetProject("worker", "../src/Worker/MyApp.Worker.csproj") .WithReference(cache) .WithReference(db); @@ -270,12 +263,12 @@ After setup, a typical solution layout looks like this: - MyApp.Worker.csproj -:::note[ProjectReference wiring] -Each `ProjectReference` in the AppHost triggers a source generator that creates a class in the `Projects` namespace. When you call `AddProject("api")`, Aspire knows the project path and how to build and launch it. See [Aspire SDK](/get-started/aspire-sdk/) for details on how project references and metadata generation work. +:::note[Project paths] +`AddDotnetProject` paths are relative to the AppHost directory. The AppHost doesn't need a `ProjectReference` to each service, so keep the services in your solution so that IDE and CI builds include them. ::: -For the full `AddProject` workflow including custom type names, multi-project solutions, and launch profiles, see [Project resources](/integrations/dotnet/project-resources/). +For launch profiles, file-based apps, and IDE behavior, see [.NET hosting](/integrations/frameworks/dotnet/dotnet-host/). @@ -308,7 +301,7 @@ For the full `AddProject` workflow including custom type names, multi-project so const db = (await builder.addPostgres('postgres')).addDatabase('mydb'); const api = await builder - .addProject('api', '../src/Api/MyApp.Api.csproj') + .addDotnetProject('api', '../src/Api/MyApp.Api.csproj') .withReference(db) .withReference(cache) .waitFor(db); @@ -513,7 +506,7 @@ The following example registers a Python API with ```csharp title="apphost.cs" showLineNumbers -#:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% +#:package Aspire.Hosting.AppHost@%ASPIRE_VERSION% #:package Aspire.Hosting.PostgreSQL@%ASPIRE_VERSION% var builder = DistributedApplication.CreateBuilder(args); diff --git a/src/frontend/src/content/docs/get-started/aspire-sdk.mdx b/src/frontend/src/content/docs/get-started/aspire-sdk.mdx index 9ecaa3d265..9eb8a62e7c 100644 --- a/src/frontend/src/content/docs/get-started/aspire-sdk.mdx +++ b/src/frontend/src/content/docs/get-started/aspire-sdk.mdx @@ -1,24 +1,24 @@ --- -title: Aspire SDK for distributed apps -description: Learn how the Aspire SDK simplifies orchestrating Aspire applications — packaging, project references, source generators, and how the SDK plugs into AppHost projects. +title: C# AppHost project configuration +description: Learn how C# AppHost projects use Microsoft.NET.Sdk, the Aspire.Hosting.AppHost and Aspire.Hosting.Dotnet packages, and the Aspire CLI bundle. --- import { Tabs, TabItem } from '@astrojs/starlight/components'; import LearnMore from '@components/LearnMore.astro'; -import ApiReference from '@components/ApiReference.astro'; -The Aspire SDK is intended for [AppHost projects](/get-started/app-host/), which serve as the orchestrator for Aspire applications. These projects are designated by their usage of the `Aspire.AppHost.Sdk` in the project file. The SDK provides features that simplify the development of Aspire apps. +A C# [AppHost](/get-started/app-host/) is a standard .NET app that uses `Microsoft.NET.Sdk`. Two packages turn it into an AppHost: -The [📦 Aspire.AppHost.Sdk](https://www.nuget.org/packages/Aspire.AppHost.Sdk) is used for building Aspire apps. +- [📦 Aspire.Hosting.AppHost](https://www.nuget.org/packages/Aspire.Hosting.AppHost) supplies the AppHost APIs and build targets. +- [📦 Aspire.Hosting.Dotnet](https://www.nuget.org/packages/Aspire.Hosting.Dotnet) supplies `AddDotnetProject` for adding .NET projects and file-based apps as resources. + +Add other hosting integrations, such as Redis or PostgreSQL, as additional packages. -The `Aspire.AppHost.Sdk` is defined in the top-level `Project` node's `Sdk` attribute: - -```xml title='*.csproj file' {1} - +```xml title='MyApp.AppHost.csproj' + Exe @@ -26,17 +26,20 @@ The `Aspire.AppHost.Sdk` is defined in the top-level `Project` node's `Sdk` attr - + + + + + ``` -The `Aspire.AppHost.Sdk` is defined in a file-based app's source file using the `#:sdk` directive: - -```csharp title='file-based app' {1} -#:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% +```csharp title='apphost.cs' +#:package Aspire.Hosting.AppHost@%ASPIRE_VERSION% +#:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% var builder = DistributedApplication.CreateBuilder(args); @@ -47,74 +50,70 @@ var builder = DistributedApplication.CreateBuilder(args); -The preceding example defines the top-level SDK as `Aspire.AppHost.Sdk`. The project also references the [📦 Aspire.Hosting.AppHost](https://www.nuget.org/packages/Aspire.Hosting.AppHost) package which brings in a number of Aspire-related dependencies. - -## SDK Features - -The Aspire SDK provides several key features. - -### Project references - -Each `ProjectReference` in the AppHost project isn't treated as standard project references. Instead, they enable the AppHost to execute these projects as part of its orchestration. Each project reference triggers a generator to create a `class` that represents the project as an `IProjectMetadata`. This metadata is used to populate the named projects in the generated `Projects` namespace. When you call the API, the `Projects` namespace is used to reference the project—passing the generated class as a generic-type parameter. +:::note[Upgrading to Aspire 17?] +`Aspire.AppHost.Sdk` is obsolete in Aspire 17 and reports warning [`ASPIRE012`](/diagnostics/aspire012/). Replace it with the packages shown here; see [Remove the obsolete AppHost SDK](/integrations/dotnet/migrate-dotnet-project-resource/#remove-the-obsolete-apphost-sdk). +::: -:::tip -To prevent a project from being treated as an Aspire resource in the AppHost, set the `IsAspireProjectResource` attribute on the `ProjectReference` element to `false`, as shown in the following example: +## Reference .NET projects -```xml - -``` - -Otherwise, by default, the `ProjectReference` is treated as Aspire project resource. -::: +Add .NET projects to the AppHost with `AddDotnetProject` and the path to a project or file-based app. The AppHost doesn't need a `ProjectReference` to the services it runs, so building the AppHost doesn't build them. Keep the services in your solution and CI builds. -For the end-to-end `AddProject` workflow, see [Project resources](/integrations/dotnet/project-resources/). +For more information, see [.NET hosting](/integrations/frameworks/dotnet/dotnet-host/). -#### Customizing generated project names +### Generated project metadata -When you reference a project in the AppHost, the Aspire SDK generates a strongly-typed class in the `Projects` namespace. By default, the generated class name is based on the project's name. However, if you have multiple projects with the same name or want to customize the generated type name, you can use the `AspireProjectMetadataTypeName` attribute. +Legacy APIs such as `AddProject` take a generated class from the `Projects` namespace instead of a path. The AppHost build generates a class for each `ProjectReference` marked with `IsAspireProjectResource="true"`. Set `ReferenceOutputAssembly="false"` so the AppHost doesn't compile against the service: -For example, if you have two microservices with the same project name (like `Presentation.Api`), you can differentiate them by setting custom names: +```xml title="MyApp.AppHost.csproj" + + + +``` + +The generated class name is based on the project name. To customize it, for example when two projects have the same name, set `AspireProjectMetadataTypeName`: -```xml +```xml title="MyApp.AppHost.csproj" ``` -This generates `Projects.MicroService1` and `Projects.MicroService2` classes, allowing you to reference each project distinctly in your AppHost: +This generates `Projects.MicroService1` and `Projects.MicroService2`. A `ProjectReference` without `IsAspireProjectResource="true"` is an ordinary reference, such as a shared library. -```csharp title="AppHost.cs" -var microservice1 = builder.AddProject("micro1"); -var microservice2 = builder.AddProject("micro2"); -``` +## AppHost build features ### Orchestrator dependencies -The Aspire SDK dynamically adds references to the [Aspire Dashboard](/dashboard/overview/) and other AppHost dependencies, such as the developer control plane (DCP) packages. These dependencies are specific to the platform that the AppHost is built on. +The AppHost relies on the [Aspire Dashboard](/dashboard/overview/) and other orchestration dependencies, such as the developer control plane (DCP) packages. These dependencies are specific to the platform that the AppHost is built on. When the AppHost project runs, the orchestrator relies on these dependencies to provide the necessary functionality to the AppHost. For more information, see [Aspire orchestration overview](/get-started/app-host/). ### Use the Aspire CLI bundle for orchestration dependencies -The Aspire SDK can source the binaries for these dependencies from platform-specific NuGet packages or from the installed **Aspire CLI bundle**. When it uses NuGet packages, the versions that run with your AppHost are tied to package restore. +The AppHost build can source the binaries for these dependencies from platform-specific NuGet packages or from the installed **Aspire CLI bundle**. When it uses NuGet packages, the versions that run with your AppHost are tied to package restore. -When it uses the Aspire CLI bundle, those binaries update when you update the Aspire CLI through [`aspire update --self`](/reference/cli/commands/aspire-update/). Without the bundle, the Aspire SDK version used by the AppHost determines the binaries by adding implicit references to the RID-specific `Aspire.Hosting.Orchestration.*` and `Aspire.Dashboard.Sdk.*` packages. +When it uses the Aspire CLI bundle, those binaries update when you update the Aspire CLI through [`aspire update --self`](/reference/cli/commands/aspire-update/). Without the bundle, the Aspire package version used by the AppHost determines the binaries by adding implicit references to the RID-specific `Aspire.Hosting.Orchestration.*` and `Aspire.Dashboard.Sdk.*` packages. C# AppHosts (`.csproj` projects and single-file `apphost.cs` AppHosts) require the Aspire CLI bundle. `AspireUseCliBundle` defaults to `true` for them, so you don't need to set it. Setting it to any other value reports error [`ASPIRE013`](/diagnostics/aspire013/), and suppressing `ASPIRE013` doesn't bypass the requirement. Non-C# AppHosts, such as F# or Visual Basic projects, default to `false` and restore orchestration dependencies from NuGet packages. They report the suppressible warning [`ASPIRE010`](/diagnostics/aspire010/) until you set `AspireUseCliBundle` to `true`. When `AspireUseCliBundle` is `true`: -- `Aspire.AppHost.Sdk` still sets AppHost properties and adds the implicit `Aspire.Hosting.AppHost` package. - Your AppHost uses the DCP and Dashboard versions installed with the Aspire CLI. -- The SDK selects the executable used to launch the AppHost as follows: +- The AppHost build selects the executable used to launch the AppHost as follows: 1. An explicit `AspireCliPath` is always authoritative. - 2. When `AspireCliInvocationMode` is set to `Dnx` or `DnxPinned`, the SDK selects a usable `dnx` host. - 3. Otherwise, the default `Path` mode selects a compatible `aspire` on `PATH`, then falls back to the SDK-paired Aspire CLI package through DNX. + 2. When `AspireCliInvocationMode` is set to `Dnx` or `DnxPinned`, the build selects a usable `dnx` host. + 3. Otherwise, the default `Path` mode selects a compatible `aspire` on `PATH`, then falls back to the Aspire CLI package paired with `Aspire.Hosting.AppHost` through DNX. - `AspireCliBundlePath` isn't an executable candidate. It explicitly identifies a bundle layout for DCP and Dashboard resolution. - If the resolved Aspire CLI has a bundle that hasn't been extracted yet, the build runs `aspire setup` through the selected `aspire` or paired DNX invocation to extract it, then resolves the bundle again. This lets an AppHost build and launch from an IDE even when the CLI installation didn't run the release install scripts. - If a required bundle layout can't be resolved, the build emits error [`ASPIRE009`](/diagnostics/aspire009/). Invalid explicit `AspireCliPath` and `AspireCliBundlePath` values remain authoritative and can produce this error. @@ -150,11 +149,11 @@ When you start an opted-in AppHost using `aspire run` or `aspire start`, the CLI #### Running with dotnet run -When `AspireUseCliBundle` is `true` and you start the AppHost with `dotnet run` instead of `aspire run`, the SDK resolves and invokes the Aspire CLI itself. Set `AspireCliInvocationMode` to control how that invocation happens: +When `AspireUseCliBundle` is `true` and you start the AppHost with `dotnet run` instead of `aspire run`, the AppHost resolves and invokes the Aspire CLI itself. Set `AspireCliInvocationMode` to control how that invocation happens: -- **`Path`** (default) — resolves a compatible `aspire` command from `AspireCliPath` (if set) or `PATH`. If no compatible command is found, it falls back to invoking the `Aspire.Cli` version paired with `Aspire.AppHost.Sdk` through [`dnx`](https://learn.microsoft.com/dotnet/core/tools/dotnet-tool-exec). +- **`Path`** (default) — resolves a compatible `aspire` command from `AspireCliPath` (if set) or `PATH`. If no compatible command is found, it falls back to invoking the `Aspire.Cli` version paired with `Aspire.Hosting.AppHost` through [`dnx`](https://learn.microsoft.com/dotnet/core/tools/dotnet-tool-exec). - **`Dnx`** — always invokes the Aspire CLI through `dnx`, using the unversioned `Aspire.Cli` package. This honors an in-scope [.NET local tool manifest](https://learn.microsoft.com/dotnet/core/tools/local-tools-how-to-use#create-a-manifest-file) (`.config/dotnet-tools.json`) if one pins `Aspire.Cli`, or resolves the latest published package when no manifest applies. -- **`DnxPinned`** — always invokes the Aspire CLI through `dnx`, using `Aspire.Cli@` pinned to the exact `Aspire.Cli` version paired with `Aspire.AppHost.Sdk`. Use this when the CLI must match the AppHost SDK version exactly, ignoring any local tool manifest. +- **`DnxPinned`** — always invokes the Aspire CLI through `dnx`, using `Aspire.Cli@` pinned to the exact `Aspire.Cli` version paired with `Aspire.Hosting.AppHost`. Use this when the CLI must match the AppHost package version exactly, ignoring any local tool manifest. Set `AspireCliInvocationMode` in your AppHost `.csproj`: diff --git a/src/frontend/src/content/docs/get-started/what-is-aspire.mdx b/src/frontend/src/content/docs/get-started/what-is-aspire.mdx index 6db4247c55..cc75df927a 100644 --- a/src/frontend/src/content/docs/get-started/what-is-aspire.mdx +++ b/src/frontend/src/content/docs/get-started/what-is-aspire.mdx @@ -91,8 +91,9 @@ And your AppHost defines the whole system in code, even for multi-language stack -```csharp title="AppHost.cs" -#:sdk Aspire.AppHost.Sdk +```csharp title="apphost.cs" +#:package Aspire.Hosting.AppHost +#:package Aspire.Hosting.Dotnet #:package Aspire.Hosting.JavaScript #:package Aspire.Hosting.PostgreSQL #:package Aspire.Hosting.Python @@ -101,7 +102,7 @@ var builder = DistributedApplication.CreateBuilder(args); var db = builder.AddPostgres("db"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../api/Api.csproj") .WithReference(db); var worker = builder.AddPythonApp("worker", "../worker", "main.py") diff --git a/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx b/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx index 1e5fcad91c..3ca1b81193 100644 --- a/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx +++ b/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx @@ -150,7 +150,7 @@ Aspire resources are just classes and methods contained within a class library t ``` :::note - The version you specify here should match the Aspire SDK version used in your solution. + The version you specify here should match the `Aspire.Hosting.AppHost` package version used by your AppHost. ::: 3. Add class library reference to the `MailDevResource.AppHost` project. diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/seed-database.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/seed-database.mdx index 53da5e9072..9618c0dd8e 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/seed-database.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/seed-database.mdx @@ -109,7 +109,7 @@ GO You must ensure that this script is copied to the AppHost's output directory, so that Aspire can execute it. Add the following XML to your *.csproj* file: ```xml title="DatabaseContainers.AppHost.csproj" {11-15} - + Exe @@ -126,10 +126,8 @@ You must ensure that this script is copied to the AppHost's output directory, so - - - - + + diff --git a/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx b/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx index bd7f8929fa..85da242d52 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/csharp-file-based-apps.mdx @@ -21,7 +21,11 @@ import ApiReference from '@components/ApiReference.astro'; This article explains how to add C# file-based app resources to your [`AppHost`](/get-started/app-host/) with the stable `Aspire.Hosting.Dotnet` integration. The examples cover C#, TypeScript, and Go AppHosts. -C# file-based applications let you run single `.cs` files without a `.csproj` project file. This feature, built on .NET 10 SDK's file-based app support, integrates directly with Aspire's orchestration. Use `AddDotnetProject` (`addDotnetProject` in TypeScript and Go AppHosts) to add a `.cs` file, `.csproj` file, or directory containing a project. +C# file-based applications let you run single `.cs` files without a `.csproj` project file. This feature, built on .NET 10 SDK's file-based app support, integrates directly with Aspire's orchestration. Use to add a `.cs` file, `.csproj` file, or directory containing a project. + +:::note[Upgrading to Aspire 17?] +`AddCSharpApp` is obsolete in Aspire 17. Replace it with `AddDotnetProject`; see [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). +::: Add the integration to your AppHost before using the examples: @@ -38,7 +42,7 @@ Use file-based apps when you need to: - Create lightweight APIs with minimal ceremony. - Experiment with Aspire integrations in a single file. -For apps with multiple source files, use `AddDotnetProject` with a `.csproj` path. In a project-based AppHost that references the app project, you can also use . +For apps with multiple source files, use `AddDotnetProject` with a `.csproj` path. ## Add C# app resource @@ -170,12 +174,12 @@ When pointing to a `.csproj` file or directory, `AddDotnetProject` doesn't requi - For more information about `AddProject`, project references, and generated `Projects` types, see [Project resources](/integrations/dotnet/project-resources/). + For supported project paths, build behavior, and publishing, see the [.NET hosting reference](/integrations/frameworks/dotnet/dotnet-host/). ## Add resource dependencies -File-based apps integrate fully with Aspire's resource model. You can reference other resources and configure service discovery just like any other project resource: +File-based apps integrate fully with Aspire's resource model. You can reference other resources and configure service discovery just like any other resource: @@ -255,7 +259,7 @@ The file-based app receives connection strings and service discovery information ## Configure options -`AddDotnetProject` accepts optional launch settings. The following example sets the launch profile and disables automatic endpoint inference from the launch profile and Kestrel configuration: +`AddDotnetProject` accepts optional launch settings. The following example selects a launch profile and explicitly keeps endpoint inference from the launch profile and Kestrel configuration enabled: @@ -324,7 +328,7 @@ if err := app.Run(); err != nil { -The available options are the same as those used with `AddProject`: +The following options are available: | Option | Description | | ------------------------- | ----------------------------------------------------------------- | @@ -334,10 +338,10 @@ The available options are the same as those used with `AddProject`: ## File-based AppHost -You can also write the AppHost itself as a file-based C# app using the `#:sdk` directive: +You can also write the AppHost itself as a file-based C# app. Reference the AppHost packages with `#:package` directives: ```csharp title="apphost.cs" -#:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% +#:package Aspire.Hosting.AppHost@%ASPIRE_VERSION% #:package Aspire.Hosting.Redis@%ASPIRE_VERSION% #:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% @@ -354,11 +358,11 @@ builder.Build().Run(); Use `#:package` directives to add NuGet package references directly in the source file instead of a `.csproj`. :::note -A TypeScript AppHost (`apphost.mts`) is already a file-based script with no project file required. The `#:sdk` and `#:package` directives are specific to the C# file-based AppHost feature and have no TypeScript equivalent. +A TypeScript AppHost (`apphost.mts`) is already a file-based script with no project file required. The `#:package` directive is specific to C# file-based apps and has no TypeScript equivalent. ::: - Learn more about the [Aspire SDK](/get-started/aspire-sdk/). + Learn more about [C# AppHost project configuration](/get-started/aspire-sdk/). ## IDE debugging behavior @@ -378,62 +382,11 @@ Be aware of the following limitations: - **Single-file only** — file-based apps are limited to a single `.cs` file per resource. - **.NET 10 SDK required** — file-based app execution requires the .NET 10 SDK or later. -## Migrating from AddCSharpApp - -Starting in Aspire 17.0, `AddCSharpApp` and the polyglot `addCSharpApp` export are obsolete. Existing C# calls now produce the `CS0618` compiler warning instead of the `ASPIRECSHARPAPPS001` experimental error, and the TypeScript API surface emits `@deprecated` instead of `@experimental`. Signatures, defaults, validation, callbacks, path handling, and launch/publish behavior are unchanged for existing `AddCSharpApp` calls — only the diagnostic metadata changed. - -Add the [📦 Aspire.Hosting.Dotnet](https://www.nuget.org/packages/Aspire.Hosting.Dotnet) integration and replace `AddCSharpApp` / `addCSharpApp` calls with `AddDotnetProject` / `addDotnetProject`: - -```bash title="Terminal" -aspire add Aspire.Hosting.Dotnet -``` - - - - -```typescript title="apphost.mts" -await builder.addDotnetProject("worker", "../worker/Program.cs"); -``` - - - - -```csharp title="AppHost.cs" -builder.AddDotnetProject("worker", "../worker/Program.cs"); -``` - - - - -```go title="apphost.go" -builder.AddDotnetProject("worker", "../worker/Program.cs") -``` - - - - -`AddDotnetProject` accepts the same kinds of paths — a `.cs` file, a `.csproj` file, or a directory containing a single `.csproj` — but returns a `DotnetProjectResource` instead of a `ProjectResource` / `CSharpAppResource`. Explicitly typed resource builders and project-specific customizations might need updating. Resources added with `AddDotnetProject` are configured for .NET SDK container publishing automatically. - -If you keep using `AddCSharpApp` and treat warnings as errors, suppress `CS0618` for the retained calls: - -```csharp title="AppHost.cs" -#pragma warning disable CS0618 -builder.AddCSharpApp("worker", "../worker/Program.cs"); -#pragma warning restore CS0618 -``` - - - See [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) - for the full `AddDotnetProject` reference, and - [What's new in Aspire 17.0](/whats-new/aspire-17/#breaking-changes) for the - obsoletion announcement. - - ## See also - [What is the AppHost?](/get-started/app-host/) - [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) -- [Project resources](/integrations/dotnet/project-resources/) -- [Aspire SDK](/get-started/aspire-sdk/) +- [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) +- [C# AppHost project configuration](/get-started/aspire-sdk/) - [Executable resources](/app-host/executable-resources/) - [What's new in Aspire 13.0](/whats-new/aspire-13/) diff --git a/src/frontend/src/content/docs/integrations/dotnet/launch-profiles.mdx b/src/frontend/src/content/docs/integrations/dotnet/launch-profiles.mdx index 7390cf0dee..15829f0035 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/launch-profiles.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/launch-profiles.mdx @@ -5,7 +5,7 @@ description: Learn how Aspire integrates with .NET launch profiles for C# AppHos --- import { Image } from 'astro:assets'; -import { Aside, Steps } from '@astrojs/starlight/components'; +import { Aside, Steps, Tabs, TabItem } from '@astrojs/starlight/components'; import dotnetIcon from '@assets/icons/dotnet.svg'; import ApiReference from '@components/ApiReference.astro'; @@ -21,7 +21,7 @@ import ApiReference from '@components/ApiReference.astro'; Aspire makes use of _launch profiles_ defined in both the AppHost and service projects to simplify configuring multiple aspects of the debugging and publishing experience for Aspire-based distributed applications. :::note -This article applies to C# AppHosts and .NET service projects that use `launchSettings.json`. TypeScript AppHosts define profiles in `aspire.config.json` instead. For more information, see [AppHost configuration](/app-host/configuration/) and [TypeScript AppHost project structure](/app-host/typescript-apphost/). +Service projects use `launchSettings.json` in every AppHost language. C# AppHosts also use `launchSettings.json` for their own profiles, while TypeScript AppHosts define AppHost profiles in `aspire.config.json`. For more information, see [AppHost configuration](/app-host/configuration/) and [TypeScript AppHost project structure](/app-host/typescript-apphost/). ::: ## Launch profile basics @@ -108,55 +108,123 @@ The Aspire templates define a similar set of launch profiles to a regular ASP.NE The C# AppHost is responsible for coordinating the launch of multiple service projects. When you run the AppHost — from the command line, Visual Studio, or another development environment — a launch profile is selected for the AppHost. In turn, the AppHost attempts to find a matching launch profile in the service projects it launches, and uses those options to control the environment and default networking configuration for the service project. -When the AppHost launches a service project, it doesn't use the `--launch-profile` option directly. Instead, Aspire resolves an effective launch profile, sets `DOTNET_LAUNCH_PROFILE` for consistency with `dotnet run` and `dotnet watch`, and adjusts the `ASPNETCORE_URLS` environment variable (derived from the `applicationUrl` field in the launch profile) to use a different port. By default, Aspire inserts a reverse proxy in front of the ASP.NET Core application to support multiple instances via . +When the AppHost launches a service project, it doesn't use the `--launch-profile` option directly. Instead, Aspire resolves an effective launch profile, sets `DOTNET_LAUNCH_PROFILE` for consistency with `dotnet run` and `dotnet watch`, and adjusts the `ASPNETCORE_URLS` environment variable (derived from the `applicationUrl` field in the launch profile) to use a different port. By default, Aspire inserts a reverse proxy in front of the ASP.NET Core application to support multiple instances via `WithReplicas`. Other settings, such as `environmentVariables`, are passed to the application without modification. ## Control launch profile selection -Ideally, you can align the launch profile names between the AppHost and its service projects so that switching profiles in the AppHost switches them across all coordinated projects at once. However, you can also specify which profile a particular project uses by passing `launchProfileName` to : +Ideally, you can align the launch profile names between the AppHost and its service projects so that switching profiles in the AppHost switches them across all coordinated projects at once. However, you can also specify which profile a particular project uses by setting the launch profile name when you call : + + + + +```typescript twoslash title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +await builder.addDotnetProject( + 'inventoryservice', + '../InventoryService/InventoryService.csproj', + { launchProfileName: 'mylaunchprofile' } +); + +await builder.build().run(); +``` + + + ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject( +builder.AddDotnetProject( "inventoryservice", - launchProfileName: "mylaunchprofile"); + "../InventoryService/InventoryService.csproj", + options => options.LaunchProfileName = "mylaunchprofile"); builder.Build().Run(); ``` + + + +```go title="apphost.go" +builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{ + LaunchProfileName: aspire.StringPtr("mylaunchprofile"), +})) +``` + + + + The preceding code launches the `inventoryservice` resource using the options from the `mylaunchprofile` launch profile. The launch profile precedence logic is as follows: -1. Use the launch profile specified by the `launchProfileName` argument if specified. +1. Use the launch profile specified by the launch profile name option, if set. 2. Use the launch profile with the same name as the AppHost (determined by reading the `DOTNET_LAUNCH_PROFILE` environment variable). 3. Use the default (first) launch profile in _launchSettings.json_. 4. Don't use a launch profile. -To force a service project to launch without a launch profile, set the `launchProfileName` argument to `null`. +To force a service project to launch without a launch profile, set the exclude launch profile option (`ExcludeLaunchProfile` in C#, `excludeLaunchProfile` in TypeScript and Go) to `true`. ## Launch profiles and endpoints for ASP.NET Core projects -When adding an ASP.NET Core project to the AppHost, Aspire parses the _launchSettings.json_ file, selects the appropriate launch profile, and automatically generates endpoints in the application model based on the URLs in the `applicationUrl` field. To modify the automatically injected endpoints, use : +When adding an ASP.NET Core project to the AppHost, Aspire parses the _launchSettings.json_ file, selects the appropriate launch profile, and automatically generates endpoints in the application model based on the URLs in the `applicationUrl` field. To modify the automatically injected endpoints, configure the generated endpoint by name: + + + + +```typescript twoslash title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +const inventory = await builder.addDotnetProject( + 'inventoryservice', + '../InventoryService/InventoryService.csproj' +); +await inventory.withEndpointCallback('https', async (endpoint) => { + await endpoint.isProxied.set(false); +}); + +await builder.build().run(); +``` + + + ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("inventoryservice") +builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj") .WithEndpoint("https", endpoint => endpoint.IsProxied = false); builder.Build().Run(); ``` + + + +```go title="apphost.go" +builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj"). + WithEndpointCallback("https", func(endpoint aspire.EndpointUpdateContext) { + endpoint.SetIsProxied(aspire.BoolPtr(false)) + }) +``` + + + + The preceding code disables the reverse proxy that Aspire deploys in front of the .NET application and allows the application to respond directly to requests over HTTP(S). ## See also -- [Project resources](/integrations/dotnet/project-resources/) +- [.NET hosting reference](/integrations/frameworks/dotnet/dotnet-host/) - [AppHost configuration](/app-host/configuration/) - [TypeScript AppHost project structure](/app-host/typescript-apphost/) - [Inner-loop networking](/fundamentals/networking-overview/) diff --git a/src/frontend/src/content/docs/integrations/dotnet/migrate-dotnet-project-resource.mdx b/src/frontend/src/content/docs/integrations/dotnet/migrate-dotnet-project-resource.mdx new file mode 100644 index 0000000000..6d28c703e6 --- /dev/null +++ b/src/frontend/src/content/docs/integrations/dotnet/migrate-dotnet-project-resource.mdx @@ -0,0 +1,286 @@ +--- +title: Migrate to the new DotnetProjectResource +description: Migrate from AddProject, AddCSharpApp, and Aspire.AppHost.Sdk to AddDotnetProject in Aspire 17, including project paths, launch options, resource types, and builds. +--- + +import { Tabs, TabItem } from '@astrojs/starlight/components'; +import LearnMore from '@components/LearnMore.astro'; +import ApiReference from '@components/ApiReference.astro'; + +Starting in Aspire 17, use from `Aspire.Hosting.Dotnet` to add .NET projects and C# file-based apps to your AppHost. It replaces `AddProject` and `AddCSharpApp`, which are obsolete. In a TypeScript AppHost, use `addDotnetProject` instead of `addProject` or `addCSharpApp`. + +The new API creates a `DotnetProjectResource`, also known as **project resource v2**. This guide applies to Aspire 17.0 and later, and explains how to migrate existing resources without losing their configuration. It also covers [removing the obsolete AppHost SDK](#remove-the-obsolete-apphost-sdk) from C# AppHosts. + +## Migrate with an agent skill + +The [Aspire project migration skill](https://github.com/microsoft/aspire-skills/tree/main/skills/aspire-project-v2-migration), named `aspire-project-v2-migration`, can assess an existing C# or TypeScript AppHost and propose resource-by-resource edits. It requires approval of the exact changes before applying them and retains unsupported or ambiguous patterns for review. + +Follow [Aspire skills](/get-started/aspire-skills/) to install the skill for your agent host. Ask the agent to assess the AppHost, resolve its Aspire version and project paths, and identify any behavior that can't be preserved before approving edits. The skill doesn't upgrade Aspire for you, and its compatibility checks can be more restrictive than the current API. + +## Why migrate? + +The original project resource uses a project-specific launch model. In C# AppHosts, its generic API also depends on MSBuild project references and generated `Projects.*` metadata. The new resource uses the executable-based model used to launch applications across Aspire's hosting integrations. + +This change gives you: + +- **Consistent registration across AppHost languages**: C#, TypeScript, and Go AppHosts add services by path. A project-based C# AppHost can use the same API as a file-based AppHost. +- **Fewer orchestration-only project references**: You can register a service without adding it as a build dependency of the AppHost or generating a metadata type for it. +- **Coordinated builds**: Aspire builds services before launching them. Compatible projects share restore and build groups, while file-based apps have coordinated direct builds. Build diagnostics are available before a dependent IDE launch. +- **One entry point for .NET apps**: The same API accepts SDK-style C#, F#, and Visual Basic projects, as well as C# file-based apps. Resources created with it also support .NET SDK container publishing. + +Legacy calls remain available and keep their implementation. Migrating selects the new resource model; suppressing an obsolete warning doesn't migrate the resource. + +:::caution[Check workflows before migrating] +Coordinated builds, the Rebuild command, and IDE debugging don't imply watch support. The new service/AppHost watcher and `aspire run --watch` integration aren't yet implemented for this resource model. If your workflow depends on watch, keep the affected resources on the legacy model until that workflow is supported. +::: + +## Add the .NET hosting integration + +Upgrade your AppHost to Aspire 17.0 before following this guide. Updating the CLI alone doesn't update the AppHost's packages. See [Upgrade Aspire](/whats-new/upgrade-aspire/). + +From the AppHost directory, add the integration: + +```bash title="Add the .NET hosting integration" +aspire add Aspire.Hosting.Dotnet +``` + +Keep the integrations used by the rest of your app. Replacing a resource doesn't require changing the AppHost's file format. Removing the obsolete `Aspire.AppHost.Sdk` is a separate step that you can do before or after migrating resources; see [Remove the obsolete AppHost SDK](#remove-the-obsolete-apphost-sdk). + +For TypeScript and Go AppHosts, use the normal [integration acquisition and SDK generation workflow](/reference/cli/commands/aspire-add/). Don't edit generated `.aspire/modules/` files. + +## Replace resource registrations + +Keep each resource's name and supported configuration, including references, dependencies, health checks, endpoints, environment variables, and application arguments. + + + + +In an existing AppHost, replace: + +```typescript title="apphost.mts — before" +const api = await builder.addProject('api', '../Api/Api.csproj'); +await api.withExternalHttpEndpoints(); +``` + +Use the .NET integration's path-based API: + +```typescript twoslash title="apphost.mts — after" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); +await api.withExternalHttpEndpoints(); + +await builder.build().run(); +``` + +The same replacement applies to `addCSharpApp`. Keep the existing `.cs`, project-file, or directory path after checking that it resolves to the intended app. + + + + +In an existing AppHost, replace: + +```csharp title="AppHost.cs — before" +var api = builder.AddProject("api") + .WithExternalHttpEndpoints(); +``` + +Find the actual project path in the AppHost's `ProjectReference` or generated metadata, then pass that path: + +```csharp title="AppHost.cs — after" +var builder = DistributedApplication.CreateBuilder(args); + +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") + .WithExternalHttpEndpoints(); + +builder.Build().Run(); +``` + +Don't derive a path from the generated type name: `AspireProjectMetadataTypeName` can override that name. There is no generic `AddDotnetProject` overload. + +For path-based `AddProject` and `AddCSharpApp` calls, keep the existing path after checking that it resolves to the intended app. If you use named arguments, change `projectPath:` to `path:`. + + + + +Go AppHosts already use the path-based API. The equivalent registration is: + +```go title="apphost.go" +package main + +import ( + "log" + + "apphost/modules/aspire" +) + +func main() { + builder, err := aspire.CreateBuilder() + if err != nil { + log.Fatal(aspire.FormatError(err)) + } + + builder.AddDotnetProject("api", "../Api/Api.csproj"). + WithExternalHttpEndpoints() + + app, err := builder.Build() + if err != nil { + log.Fatal(aspire.FormatError(err)) + } + if err := app.Run(); err != nil { + log.Fatal(aspire.FormatError(err)) + } +} +``` + + + + +Paths are relative to the AppHost directory unless absolute. Supported inputs are `.csproj`, `.fsproj`, `.vbproj`, and `.cs` files, or a directory containing exactly one supported project. Specify the project filename when a directory contains multiple projects. Projects must be SDK-style; F# scripts aren't supported. C# file-based apps require .NET 10 or later. + + + See [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) for + `.cs` app directives and file-based AppHost examples. + + +## Preserve launch options + +The replacement API doesn't take the old string launch-profile argument. C# uses a configuration callback with `ProjectResourceOptions`; TypeScript uses a flat `DotnetProjectOptions` object. + +| Existing configuration | Replacement configuration | +| ------------------------------------------------ | ------------------------------------------------------------------------------------ | +| C# `AddProject` with no profile argument | Omit the configuration callback to keep default profile selection | +| C# `launchProfileName: "https"` | `options => options.LaunchProfileName = "https"` | +| C# `launchProfileName: null` | `options => options.ExcludeLaunchProfile = true` | +| C# `Action` callback | Keep supported option values in the new callback | +| TypeScript `{ launchProfileOrOptions: "https" }` | `{ launchProfileName: "https" }` | +| TypeScript omitted or null legacy profile option | Omit the new options argument to keep default selection | +| Existing exclusion of launch profiles | Set `ExcludeLaunchProfile` in C#, or `excludeLaunchProfile` in TypeScript, to `true` | +| Existing exclusion of Kestrel endpoint discovery | Preserve `ExcludeKestrelEndpoints` in C#, or `excludeKestrelEndpoints` in TypeScript | + +:::caution[An explicit null isn't always the default] +The legacy C# string overload uses `launchProfileName: null` to disable launch profiles. Setting `LaunchProfileName` to `null` on the new options uses default selection instead. Use `ExcludeLaunchProfile = true` to preserve the old behavior. +::: + +Don't nest TypeScript options under an `options` property. A legacy `ProjectResourceOptions` handle isn't a plain object; translate its known configuration rather than spreading it into the new DTO. `excludeKestrelEndpoints` only controls endpoint discovery in Aspire's model, not the service's own Kestrel configuration. + +See [Configure options](/integrations/frameworks/dotnet/dotnet-host/#configure-options) for current examples. + +## Update resource types and customizations + +The returned builder is `IResourceBuilder`, not `IResourceBuilder` or `IResourceBuilder`. Update explicit local types and resource lookups associated with migrated registrations. + +In C#, `DotnetProjectResource` is in the `Aspire.Hosting.Dotnet` namespace. The builder extensions remain in `Aspire.Hosting`, and `IResourceBuilder` is in `Aspire.Hosting.ApplicationModel`. + +Review helper return types, generic constraints, casts, and queries that depend on the original resource type. A method constrained to `ProjectResource` won't automatically accept the new resource. Use the capability your helper actually requires rather than broadly replacing every type constraint. + +Don't replace specialized APIs such as `AddAzureFunctionsProject`, `AddMauiProject`, or `AddSqlProject` with `AddDotnetProject`. Blazor gateways have a separate API; review the [Blazor hosting guidance](/integrations/dotnet/blazor-hosting/) before migrating a gateway or changing its publishing configuration. + +## Review project references and builds + +Remove an AppHost `ProjectReference` or file-based `#:project` directive only if it exists exclusively for migrated resources and no generated metadata consumer remains. + +Keep references needed for: + +- Code or library dependencies +- Resources you haven't migrated +- EF migration metadata, Blazor WebAssembly metadata, or specialized integrations +- Testing APIs such as `DistributedApplicationTestingBuilder.CreateAsync()` +- Build-only behavior whose purpose you haven't established + +Don't remove service-to-library references inside application projects. Don't set `ReferenceOutputAssembly="false"` as a substitute for checking whether an AppHost reference can be removed; that reference still participates in builds. + +Keep runtime `WithEnvironment` values at runtime. Use only for an intentional build-time setting on a supported project. File-based `.cs` apps don't support build-only environment variables. Review [IDE build and debugging behavior](/integrations/frameworks/dotnet/dotnet-host/#launch-from-an-ide) if you customize builds. + +## Remove the obsolete AppHost SDK + +In Aspire 17, the `Aspire.AppHost.Sdk` used by C# AppHosts is also obsolete and reports warning [ASPIRE012](/diagnostics/aspire012/). It still works, so you can remove it and migrate resources in either order. Running `aspire update` doesn't remove the SDK. + +C# AppHosts now use the standard `Microsoft.NET.Sdk` with two explicit packages: `Aspire.Hosting.AppHost` supplies the AppHost build targets, and `Aspire.Hosting.Dotnet` supplies `AddDotnetProject`. The dashboard and developer control plane (DCP) come from the [Aspire CLI bundle](/get-started/aspire-sdk/#use-the-aspire-cli-bundle-for-orchestration-dependencies), which C# AppHosts require. + + + + +Replace the SDK in the AppHost project file and add the packages: + +```xml title="MyApp.AppHost.csproj — before" + +``` + +```xml title="MyApp.AppHost.csproj — after" + + + + Exe + net10.0 + + + + + + + + + +``` + +If the project uses a nested `` element instead, remove that element. If you use Central Package Management, omit the `Version` attributes and add matching `PackageVersion` items to `Directory.Packages.props`; otherwise restore reports `NU1008`. + + + + +Replace the SDK directive with package directives: + +```csharp title="apphost.cs — before" +#:sdk Aspire.AppHost.Sdk@%ASPIRE_VERSION% +``` + +```csharp title="apphost.cs — after" +#:package Aspire.Hosting.AppHost@%ASPIRE_VERSION% +#:package Aspire.Hosting.Dotnet@%ASPIRE_VERSION% +``` + +Keep your other directives, run configuration, and user secrets. + + + + +The SDK automatically turned every AppHost `ProjectReference` into a resource reference that generated `Projects.*` metadata. `Microsoft.NET.Sdk` doesn't, so check each reference after switching: + +- **Migrated to `AddDotnetProject`**: Remove the reference unless something else needs it. See [Review project references and builds](#review-project-references-and-builds). +- **Still using `AddProject` or another API that needs `Projects.*` metadata**: Mark the reference explicitly. Without these attributes, the generated type is missing and the build reports `CS0234`. + + ```xml title="MyApp.AppHost.csproj" + + ``` + +- **Shared library**: Keep it as an ordinary `ProjectReference`. + +If you need more time, suppress the warning temporarily by setting `SuppressAspireAppHostSdkObsoleteWarning` to `true` or adding `ASPIRE012` to `NoWarn`. Suppressing `ASPIRE012` doesn't suppress the `CS0618` warnings for legacy resource APIs. + +## Verify publishing and runtime behavior + +Resources added through `AddDotnetProject` are configured for .NET SDK container publishing automatically. You don't need to retain an obsolete API just to publish a project. + +Preserve supported container settings and publisher customizations. Review custom publishers, image managers, and code that directly constructs resource types separately; the resource's type alone doesn't configure the publishing pipeline. + +For file-based apps, publishing preserves the SDK's defaults, including Native AOT. Native AOT can't cross-compile between operating systems. If you publish a Linux container from Windows or macOS, choose whether to publish on the target operating system or intentionally change the app's publishing settings. See [Publishing](/integrations/frameworks/dotnet/dotnet-host/#publishing). + +After migrating, compare resource names, startup behavior, selected launch profiles, environment variables, endpoints, references, health checks, and any deployment artifacts with the original app. Check IDE debugging and build customizations if you use them. A successful local run alone doesn't verify publishing. + +## Remove obsolete suppressions + +In Aspire 17, retained `AddProject` and `AddCSharpApp` calls report `CS0618`. If warnings are errors, a retained legacy call can still prevent your AppHost from building. + +After migrating, remove suppressions for `ASPIRECSHARPAPPS001` that are no longer needed. `AddDotnetProject` and `DotnetProjectResource` don't require `ASPIREDOTNETPROJECT001` suppressions. Other APIs used by your app can still have their own experimental diagnostics; don't remove those suppressions without checking their callers. + +## See also + +- [.NET hosting reference](/integrations/frameworks/dotnet/dotnet-host/) +- [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) +- [Upgrade Aspire](/whats-new/upgrade-aspire/) +- [Aspire 17 breaking changes](/whats-new/aspire-17/#breaking-changes) diff --git a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx index 529591ab70..8738f5fa71 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx @@ -599,7 +599,7 @@ require the later `11.0.100-rtm.26473.104` SDK build (or a stable `11.0.100` or The C#, TypeScript, and Go AppHosts differ in how they reference .NET projects: -- **C# AppHost**: A `ProjectReference` in the AppHost `.csproj` causes the Aspire SDK to generate a `Projects.*` type during build. `AddProject("api")` uses that generated type to locate and launch the project. For the SDK-level build behavior behind this generation step, see [Aspire SDK](/get-started/aspire-sdk/). +- **C# AppHost**: A `ProjectReference` marked as an Aspire project resource generates a `Projects.*` type during build. `AddProject("api")` uses that generated type to locate and launch the project. For the build behavior behind this generation step, see [Generated project metadata](/get-started/aspire-sdk/#generated-project-metadata). - **TypeScript AppHost**: No `ProjectReference` is needed. `addProject("api", "../ApiService/ApiService.csproj")` points directly to the `.csproj` file. The TypeScript SDK resolves the project path at startup. @@ -667,7 +667,7 @@ micro2 := builder.AddDotnetProject("micro2", "../Microservice2/Presentation.Api/ ## AddProject vs. AddCSharpApp :::note -`AddCSharpApp` is obsolete starting in Aspire 17.0. Use [`AddDotnetProject`](/integrations/frameworks/dotnet/dotnet-host/) from `Aspire.Hosting.Dotnet` for new path-based project or file-based app resources instead. See [Migrating to AddDotnetProject](/integrations/dotnet/csharp-file-based-apps/#migrating-to-adddotnetproject). +`AddProject` and `AddCSharpApp` are obsolete starting in Aspire 17.0. Use [`AddDotnetProject`](/integrations/frameworks/dotnet/dotnet-host/) from `Aspire.Hosting.Dotnet` for new project or file-based app resources instead. See [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). ::: In a **C# AppHost**, use `AddProject` when you have a standard `.csproj`, can add a `ProjectReference` from the AppHost, and want generated `Projects.*` types plus launch-profile integration. Use `AddCSharpApp` when you want to run a single `.cs` file, or when you want to point at a project path directly without adding a `ProjectReference` from the AppHost. @@ -684,7 +684,7 @@ The skill doesn't upgrade your AppHost's Aspire version. Upgrade first, then fol ## See also -- [Aspire SDK](/get-started/aspire-sdk/) +- [C# AppHost project configuration](/get-started/aspire-sdk/) - [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) - [Launch profiles](/integrations/dotnet/launch-profiles/) - [.NET MAUI integration](/integrations/dotnet/maui/) diff --git a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx index bcd8d156c5..d0d9c9a809 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx @@ -20,35 +20,21 @@ import ApiReference from '@components/ApiReference.astro'; classOverride="float-inline-left icon" /> -This article is the reference for the Aspire Dotnet hosting integration. It enumerates the AppHost APIs — with examples for both `AppHost.cs` and `apphost.mts` — that you use to add C# projects and file-based C# apps **by path** in your [`AppHost`](/get-started/app-host/) project. +Use the `Aspire.Hosting.Dotnet` integration to add SDK-style .NET projects and C# file-based apps by path in your [`AppHost`](/get-started/app-host/). The examples cover TypeScript, C#, and Go AppHosts. If you're new to the Dotnet integration, start with the [Get started with the .NET / C# app integration](/integrations/frameworks/dotnet/dotnet-get-started/) guide. -:::note -Starting with Aspire 17.0, `Aspire.Hosting.Dotnet` is a stable package that follows Aspire's normal stable versioning. Existing experimental integration-authoring APIs still require you to suppress [`ASPIREPROJECTS001`](/diagnostics/aspireprojects001/), and other experimental features, such as watch support, remain experimental. - -Starting with Aspire 13.6, , `DotnetProjectResource`, and the related overloads no longer require suppressing [`ASPIREDOTNETPROJECT001`](/diagnostics/aspiredotnetproject001/). You can remove existing suppressions for these APIs after upgrading. -Starting with Aspire 17.0, `AddCSharpApp` / `addCSharpApp` is obsolete. If you're migrating existing `AddCSharpApp` calls to this integration, see [Migrating to AddDotnetProject](/integrations/dotnet/csharp-file-based-apps/#migrating-to-adddotnetproject). +:::note[Upgrading to Aspire 17?] +In Aspire 17, `AddProject` and `AddCSharpApp` are obsolete. Use `AddDotnetProject` from the stable `Aspire.Hosting.Dotnet` package instead. See [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) for the benefits, project-path conversion, resource-type changes, and compatibility checks. ::: -If your C# AppHost needs to reference the resource type directly — for example, to declare a strongly typed variable or a method parameter — import it from the `Aspire.Hosting.Dotnet` namespace, matching the pattern used by the Go, Python, and JavaScript hosting integrations: - -```csharp -using Aspire.Hosting.Dotnet; - -var builder = DistributedApplication.CreateBuilder(args); - -IResourceBuilder api = - builder.AddDotnetProject("api", "../api/api.csproj"); -``` - :::note[Prerequisites] The **.NET SDK** must be available on the `PATH` of the machine running the AppHost. File-based C# apps (`.cs`) require **.NET 10 or later**. ::: ## Installation -To start building an Aspire app that adds a C# project or file-based app by path, install the [📦 Aspire.Hosting.Dotnet](https://www.nuget.org/packages/Aspire.Hosting.Dotnet) NuGet package: +To add a .NET project or C# file-based app by path, install the [📦 Aspire.Hosting.Dotnet](https://www.nuget.org/packages/Aspire.Hosting.Dotnet) NuGet package: @@ -119,9 +105,9 @@ This updates your `aspire.config.json` with the Dotnet hosting integration packa -## Add a C# project or file-based app by path +## Add a .NET project or file-based app by path -Use `AddDotnetProject` / `addDotnetProject` to add a C# project or file-based app resource by path. The `path` argument can point at a project file (`.csproj`), a directory containing a single `.csproj`, or a file-based app (`.cs`). If the path isn't absolute, it's computed relative to the AppHost directory. +Use / `addDotnetProject` to add a resource by path. Supported inputs are SDK-style C#, F#, and Visual Basic project files (`.csproj`, `.fsproj`, and `.vbproj`), a directory containing exactly one supported project, or a C# file-based app (`.cs`). If the path isn't absolute, it's computed relative to the AppHost directory. Specify a project filename if a directory contains multiple supported projects. F# scripts and non-SDK project systems aren't supported. @@ -176,12 +162,21 @@ if err := app.Run(); err != nil { -The resource launches with `dotnet run --project ` for a project file, or `dotnet run --file ` for a file-based app. Endpoints, environment variables, and service discovery are configured from the project's `launchSettings.json` and Kestrel configuration, matching . +The resource launches with `dotnet run --project ` for a project file, or `dotnet run --file ` for a file-based app. Endpoints, environment variables, and service discovery are configured from the project's `launchSettings.json` and Kestrel configuration. + +Because the resource is registered by path, the AppHost doesn't need a `ProjectReference` to the app. Before the resource starts, Aspire validates the path and, for file-based apps, that the active .NET SDK version is 10 or later. + +To refer to the resource type in a C# AppHost, for example in a helper method signature, add `using Aspire.Hosting.Dotnet;` and use `IResourceBuilder`. ## Add a file-based C# app A file-based app is a single `.cs` file run directly with `dotnet run --file`, without a `.csproj`. File-based apps require **.NET 10 or later**. + + See [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) for app + directives, file-based AppHost examples, and debugging considerations. + + @@ -218,47 +213,7 @@ builder.AddDotnetProject("inventoryservice", "../InventoryService.cs") ## Configure options -Pass a configuration action to set additional options such as the launch profile: - - - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -builder.AddDotnetProject("inventoryservice", @"..\InventoryService.cs", o => o.LaunchProfileName = "https"); - -builder.Build().Run(); -``` - - - - -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -await builder.addDotnetProject('inventoryservice', '../InventoryService.cs', { - launchProfileName: 'https', -}); - -await builder.build().run(); -``` - - - - -```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{LaunchProfileName: aspire.StringPtr("https")})) -``` - - - - -The resource is added as an [`ExecutableResource`](/app-host/executable-resources/) rather than a `ProjectResource`, so it doesn't need to be referenced from the AppHost's own solution. Before the resource starts, Aspire validates that the path resolves to a `.csproj` or `.cs` file (or a directory containing a single `.csproj`) and, for file-based apps, that the active .NET SDK version is 10 or later. - -The TypeScript `addDotnetProject` overload accepts a plain options object rather than the shared `ProjectResourceOptions` handle used by the legacy `addProject` / `addCSharpApp` polyglot APIs, so it can be constructed directly from a generated SDK caller without an RPC round-trip: +Pass options to choose a launch profile or control how Aspire derives endpoints from the project: @@ -311,39 +266,40 @@ builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", aspire.Ad - `excludeLaunchProfile: true` disables launch profiles entirely and takes precedence over a supplied `launchProfileName`. - `excludeKestrelEndpoints: true` stops Aspire from deriving model endpoints from the project's Kestrel configuration. It doesn't rewrite or disable the service's own Kestrel configuration. -These properties have the same behavior as the corresponding `LaunchProfileName`, `ExcludeLaunchProfile`, and `ExcludeKestrelEndpoints` properties on the C# `ProjectResourceOptions` type. The options are polyglot-specific to `addDotnetProject`; they don't change the shared `ProjectResourceOptions` handle used by the legacy `addProject` / exports. - ## Launch from an IDE -Visual Studio builds the AppHost and its MSBuild dependencies, but path-based project resources aren't `ProjectReference` items, so Visual Studio doesn't build them. Before launching, Aspire builds SDK-style project resources itself and surfaces any compiler diagnostics. A compile failure prevents the dependent IDE launch request instead of producing a missing-executable `500 Internal Server Error`. This lets a new app launch on its first Visual Studio F5 without running `aspire run` or building each service manually. +Aspire builds SDK-style project resources before launching them and surfaces any compiler diagnostics. A compile failure stops the resource from launching. You don't need to build each service yourself, whether you start the app with `aspire run` or from an IDE. -IDEs with external build support, such as Visual Studio Code, coordinate the build with Aspire. Aspire builds each resource once, and the IDE launches the resulting output without building it again. You can customize the build of SDK-style projects by calling `WithBuildEnvironment` in the AppHost, and file-based apps are fully supported: their builds are coordinated and serialized just like when you use `aspire run`. +IDEs with external build support, such as Visual Studio Code, coordinate the build with Aspire. Aspire builds each resource once, and the IDE launches the resulting output without building it again. You can customize the build of SDK-style projects by calling in the AppHost, and file-based apps are fully supported: their builds are coordinated and serialized just like when you use `aspire run`. -IDEs without external build support still launch project resources after Aspire builds them, but with these limitations: +IDEs without external build support, such as Visual Studio, still launch project resources after Aspire builds them, but with these limitations: - The IDE might build projects again before launching them, because Aspire can't suppress the IDE build. -- `WithBuildEnvironment` isn't supported. Aspire fails to start the application and reports an error instead of launching output that the IDE can't reliably locate. Run the application with `aspire run`, use an IDE with external build support, or remove the build customization. -- File-based apps build themselves when they launch. They wait for Aspire to finish building project resources, but they aren't serialized with each other, so separate file-based apps can race when they share `#:project` outputs. In Visual Studio, `WaitForStart` only waits for the file-based app process to start, not for its build to finish. To avoid races, run with `aspire run`, use an IDE with external build support, or add a health check to the preceding app that passes only after it finishes building and call `WaitFor` on the next app. +- This build customization isn't supported. Aspire fails to start the application and reports an error instead of launching output that the IDE can't reliably locate. Run the application with `aspire run`, use an IDE with external build support, or remove the build customization. +- File-based apps build themselves when they launch. They wait for Aspire to finish building project resources, but they aren't serialized with each other, so separate file-based apps can race when they share `#:project` outputs. `WaitForStart` only waits for the file-based app process to start, not for its build to finish. To avoid races, run with `aspire run`, use an IDE with external build support, or add a health check to the preceding app that passes only after it finishes building and call `WaitFor` on the next app. ## Publishing -Automatic project publishing for `DotnetProjectResource` isn't currently supported. A plain -`DotnetProjectResource` causes `aspire publish` and `aspire deploy` to fail with an actionable error -instead of emitting an `executable.v0` manifest containing machine-local paths. +Resources created with `AddDotnetProject` are automatically configured for the .NET SDK container-publishing pipeline. Use them with your [deployment target](/deployment/deploy-with-aspire/). + +Use / `withContainerBuildOptions` to configure supported image settings. See [Container registries](/app-host/container-registry/) for image naming, tags, and registries. -Use one of these alternatives: +Constructing a `DotnetProjectResource` directly doesn't configure metadata, coordinated builds, or publishing. Prefer the builder API. -- Use `AddProject(...)` for a project referenced by a C# AppHost. -- Use `AddCSharpApp(...)` / `addCSharpApp(...)` for a path-based project or file-based app that - should use standard .NET project publishing. -- Call `PublishAsDockerFile(...)` / `publishAsDockerFile(...)` to configure container publishing - explicitly. -- Call when the resource is intentionally - available only during local orchestration. +For other publishing models: + +- Call / `publishAsDockerFile` to use an explicit Dockerfile instead of .NET SDK container publishing. +- Call for a resource that's intentionally available only during local orchestration. + +:::caution[File-based apps and Native AOT] +File-based apps retain the SDK's publishing defaults, including Native AOT. Native AOT can't cross-compile between operating systems, so publishing a Linux container from Windows or macOS can fail. To retain Native AOT, publish on the target operating system. If you intentionally choose framework-dependent publishing instead, set `#:property PublishAot=false` in the `.cs` app. See [Native AOT cross-compilation](https://learn.microsoft.com/dotnet/core/deploying/native-aot/cross-compile). +::: ## See also - [.NET documentation](https://learn.microsoft.com/dotnet/) - [Get started with the .NET / C# app integration](/integrations/frameworks/dotnet/dotnet-get-started/) +- [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) +- [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) - [Aspire integrations overview](/integrations/overview/) - [Aspire GitHub repo](https://github.com/microsoft/aspire) diff --git a/src/frontend/src/content/docs/reference/cli/commands/aspire-init.mdx b/src/frontend/src/content/docs/reference/cli/commands/aspire-init.mdx index db20e06e3f..ab7dd40f40 100644 --- a/src/frontend/src/content/docs/reference/cli/commands/aspire-init.mdx +++ b/src/frontend/src/content/docs/reference/cli/commands/aspire-init.mdx @@ -34,12 +34,12 @@ This command defaults to **interactive** mode. When executed without any options The command adapts to the repo it finds: -- **C# file-based AppHost** (when selected interactively) — creates `apphost.cs` with `#:sdk` and `#:package` directives for a lightweight single-file orchestrator. +- **C# file-based AppHost** (when selected interactively) — creates `apphost.cs` with `#:package` directives for a lightweight single-file orchestrator. - **TypeScript AppHost** (when selected interactively) — creates `apphost.mts` with the generated `.aspire/modules/` folder. If the repo already has a root `package.json`, the AppHost is created as a nested `aspire-apphost/` package and the root `aspire.config.json` points to `aspire-apphost/apphost.mts`. - **Go AppHost** (when selected interactively): creates `apphost.go`, a `go.mod` that points at the generated SDK, and the generated `.aspire/modules/` folder. :::note -When a `.sln` or `.slnx` is present, the C# option creates a **project-based AppHost** instead — an `AppHost.csproj` added to the solution with `ProjectReference` items and strongly-typed `AddProject()` calls. +When a `.sln` or `.slnx` is present, the C# option creates a **project-based AppHost** instead — an `AppHost.csproj` added to the solution. ::: In all cases, the AppHost language does not limit what you can orchestrate — C#, JavaScript, Python, Go, Rust, Java, containers, and more can all be modeled in the same application model. diff --git a/src/frontend/src/content/docs/whats-new/aspire-17.mdx b/src/frontend/src/content/docs/whats-new/aspire-17.mdx index 936a0c2659..fa1c5c7969 100644 --- a/src/frontend/src/content/docs/whats-new/aspire-17.mdx +++ b/src/frontend/src/content/docs/whats-new/aspire-17.mdx @@ -247,9 +247,11 @@ Aspire 17.0 raises its minimum supported .NET version to **.NET 10**. Review you The `Aspire.Hosting.Dotnet` integration now follows stable package versioning for .NET projects added by path. The older `AddProject` APIs are deprecated, not removed. Use the path-based project model when updating your AppHost; see [microsoft/aspire#21360](https://github.com/microsoft/aspire/pull/21360) for migration details. +`Aspire.AppHost.Sdk` is also obsolete. C# AppHosts that still use it report warning [`ASPIRE012`](/diagnostics/aspire012/) but keep working, so you can migrate in stages. New C# AppHosts use `Microsoft.NET.Sdk` with explicit `Aspire.Hosting.AppHost` and `Aspire.Hosting.Dotnet` package references, and `aspire update` doesn't remove the SDK for you. For details, see [microsoft/aspire#20867](https://github.com/microsoft/aspire/pull/20867). + - Follow the [17.0 project migration guide on GitHub](https://github.com/microsoft/aspire/blob/a509f094e0ee87d17dc0e1cc9bca84f7ca2623da/docs/migrate-from-addproject.md) - for project paths, launch profiles, and scenarios that retain the legacy model. + See [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) + for project paths, launch profiles, removing the AppHost SDK, and scenarios that retain the legacy model. ### Experimental APIs graduated to stable @@ -463,7 +465,7 @@ builder.AddDotnetProject("api", "./api/api.cs"); `AddDotnetProject` accepts the same kinds of paths (a `.cs` file, a `.csproj` file, or a directory containing a single `.csproj`) but returns a `DotnetProjectResource` rather than a `ProjectResource` or `CSharpAppResource`. Explicitly typed resource builders and project-specific customizations might need updating. Existing `AddCSharpApp` calls keep their current launch and publishing behavior; if you treat warnings as errors, suppress `CS0618` until you migrate. - See [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/#migrating-to-adddotnetproject) + See [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) for migration guidance. For the obsoletion details, see [microsoft/aspire#20825](https://github.com/microsoft/aspire/pull/20825). diff --git a/src/frontend/src/content/docs/whats-new/upgrade-aspire.mdx b/src/frontend/src/content/docs/whats-new/upgrade-aspire.mdx index a3b27b74b1..100015eaaa 100644 --- a/src/frontend/src/content/docs/whats-new/upgrade-aspire.mdx +++ b/src/frontend/src/content/docs/whats-new/upgrade-aspire.mdx @@ -43,6 +43,16 @@ If you're new to Aspire, there's no reason to upgrade anything. See [prerequisit For more information, see [`aspire update` command reference](/reference/cli/commands/aspire-update/). +## Migrate .NET project resources (Aspire 17) + +Starting in Aspire 17, `AddProject` and `AddCSharpApp` are obsolete. `aspire update` updates your packages but doesn't rewrite these calls. Replace them with `AddDotnetProject` from the `Aspire.Hosting.Dotnet` integration to use the new `DotnetProjectResource`. + +C# AppHosts that use `Aspire.AppHost.Sdk` also report warning [`ASPIRE012`](/diagnostics/aspire012/). `aspire update` doesn't remove the SDK; replace it with `Microsoft.NET.Sdk` and explicit `Aspire.Hosting.AppHost` and `Aspire.Hosting.Dotnet` package references. + + +For steps, caveats, and an optional agent skill, see [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). + + ## Try a prerelease build To test your app against an upcoming release before it ships, switch both the CLI and your app to the `staging` channel. Staging builds come from the current release branch and aren't intended for production use. Use a branch or a throwaway copy of your repository. From fc4d9e2b4ca76e653e6bc3c07b53b154f2e1a06e Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 16:23:56 -0500 Subject: [PATCH 04/12] docs(skills): teach AddDotnetProject and drop Aspire.AppHost.Sdk in agent guidance Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .agents/skills/doc-pr-reviewer/SKILL.md | 12 +++++++++- .agents/skills/doc-writer/SKILL.md | 22 +++++++++++++------ .../references/common-documentation-issues.md | 4 ++-- .../references/integration-documentation.md | 6 ++--- .github/agents/release-verifier.agent.md | 4 ++-- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.agents/skills/doc-pr-reviewer/SKILL.md b/.agents/skills/doc-pr-reviewer/SKILL.md index ff1c4d8c8b..f3e2ff93dc 100644 --- a/.agents/skills/doc-pr-reviewer/SKILL.md +++ b/.agents/skills/doc-pr-reviewer/SKILL.md @@ -94,7 +94,7 @@ The docs site provides placeholders for current-version values: Flag hard-coded Aspire versions as a review finding when they appear in current copy/paste guidance that should track the active release, including: -- `Aspire.AppHost.Sdk` declarations in project files or file-based apps. +- `Aspire.Hosting.*` package references in AppHost project files. - `#:package Aspire.*@...` file-based app package directives. - Aspire CLI or AppHost sample output that reports the current CLI/AppHost version. @@ -117,6 +117,16 @@ Do **not** require placeholders for intentionally fixed versions, including: If the intent is ambiguous, leave a `COMMENT` asking whether the version should track the current release instead of requesting changes outright. +## Legacy .NET project API review + +Flag new or edited evergreen AppHost samples that use the obsolete +`AddProject`/`addProject`, `AddCSharpApp`/`addCSharpApp`, `Projects.*` types, +`Aspire.AppHost.Sdk`, or `#:sdk` directives. Current samples use +`AddDotnetProject("name", "path")` from `Aspire.Hosting.Dotnet`, and C# AppHosts +use `Microsoft.NET.Sdk` with package references. Don't flag historical +what's-new pages, the [migration guide](/integrations/dotnet/migrate-dotnet-project-resource/), +or diagnostics that describe the legacy APIs. + ## Phase A artifact When Phase A finishes, write down (in memory) a frozen Phase A result containing: diff --git a/.agents/skills/doc-writer/SKILL.md b/.agents/skills/doc-writer/SKILL.md index 5900108197..3701341183 100644 --- a/.agents/skills/doc-writer/SKILL.md +++ b/.agents/skills/doc-writer/SKILL.md @@ -410,7 +410,7 @@ Always include a descriptive title: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); // After adding all resources, run the app... builder.Build().Run(); @@ -423,7 +423,7 @@ import { createBuilder } from "./.aspire/modules/aspire.mjs"; const builder = await createBuilder(); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await builder.build().run(); ``` @@ -484,7 +484,7 @@ const builder = await createBuilder(); const cache = await builder.addRedis("cache"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(cache); await builder.build().run(); @@ -498,7 +498,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache); builder.Build().Run(); @@ -523,7 +523,7 @@ func main() { } cache := builder.AddRedis("cache") - api := builder.AddDotnetProject("api", "../Api/Api.csproj"). + builder.AddDotnetProject("api", "../Api/Api.csproj"). WithReference(cache) app, err := builder.Build() @@ -558,6 +558,15 @@ If a section heading should appear in the **On this page** table of contents, ke | Async pattern | `await` each builder call | Synchronous fluent calls | Synchronous fluent calls; errors surface at `Build()` | | Build & run | `await builder.build().run()` | `builder.Build().Run()` | `app, err := builder.Build()` then `app.Run()` | +### .NET projects in AppHost samples + +Add .NET projects with `AddDotnetProject("name", "path")` (`addDotnetProject` in TypeScript and `AddDotnetProject` in Go) from the `Aspire.Hosting.Dotnet` integration. The path can be a `.csproj` file, a directory containing one project, or a file-based `.cs` app. + +- Do **not** use the obsolete `AddProject()`, `AddProject("name", "path")`, `addProject`, `AddCSharpApp`, or `addCSharpApp` APIs in new or updated evergreen docs. They return the legacy `ProjectResource`. +- Do **not** show `Aspire.AppHost.Sdk` in project files or `#:sdk` in file-based apps. C# AppHosts use `Microsoft.NET.Sdk` with `Aspire.Hosting.AppHost` and `Aspire.Hosting.Dotnet` package references (`#:package` directives in file-based apps). +- When a page needs to mention the legacy APIs, keep it to a short `:::note[Upgrading to Aspire 17?]` that links to [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). Don't add history to evergreen pages. +- Historical what's-new pages and diagnostics about the legacy APIs (such as `ASPIRE012` and `ASPIRECSHARPAPPS001`) are the exceptions. + ### Prose Guidelines When writing narrative text around AppHost examples: @@ -739,8 +748,7 @@ the active Aspire release: | `%ASPIRE_VERSION%` | Full current stable version, including patch | | `%ASPIRE_VERSION_MAJOR_MINOR%` | Current major/minor display or installer version | -Use these placeholders in package references, `Aspire.AppHost.Sdk` -declarations, file-based app directives, CLI/AppHost output, and generic +Use these placeholders in package references, file-based app directives, CLI/AppHost output, and generic installation examples that should advance with the release branch. This applies to localized documentation as well as English documentation. diff --git a/.agents/skills/doc-writer/references/common-documentation-issues.md b/.agents/skills/doc-writer/references/common-documentation-issues.md index 64901034a7..86a155eb46 100644 --- a/.agents/skills/doc-writer/references/common-documentation-issues.md +++ b/.agents/skills/doc-writer/references/common-documentation-issues.md @@ -19,7 +19,7 @@ The following rules are derived from common feedback patterns in documentation P ✅ Correct: ```csharp - builder.AddProject("api") + builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(redis) .WithExternalHttpEndpoints(); ``` @@ -27,7 +27,7 @@ The following rules are derived from common feedback patterns in documentation P ❌ Incorrect (aligned indentation): ```csharp - builder.AddProject("api") + builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(redis) .WithExternalHttpEndpoints(); ``` diff --git a/.agents/skills/doc-writer/references/integration-documentation.md b/.agents/skills/doc-writer/references/integration-documentation.md index 9cb7d9988b..c29e4918d0 100644 --- a/.agents/skills/doc-writer/references/integration-documentation.md +++ b/.agents/skills/doc-writer/references/integration-documentation.md @@ -140,7 +140,7 @@ const builder = await createBuilder(); const tech = await builder.addTechnology("tech"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(tech); await builder.build().run(); @@ -154,7 +154,7 @@ var builder = DistributedApplication.CreateBuilder(args); var tech = builder.AddTechnology("tech"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(tech); builder.Build().Run(); @@ -179,7 +179,7 @@ func main() { } tech := builder.AddTechnology("tech") - api := builder.AddDotnetProject("api", "../Api/Api.csproj"). + builder.AddDotnetProject("api", "../Api/Api.csproj"). WithReference(tech) app, err := builder.Build() diff --git a/.github/agents/release-verifier.agent.md b/.github/agents/release-verifier.agent.md index 4350052b67..65a62108c5 100644 --- a/.github/agents/release-verifier.agent.md +++ b/.github/agents/release-verifier.agent.md @@ -210,10 +210,10 @@ grep -rnE '%ASPIRE_VERSION%-(preview|alpha|beta|rc)(\.[0-9A-Za-z-]+)+' src/front --exclude-dir="whats-new" ``` -Also search for stale SDK version references: +Also search for stale AppHost package and legacy SDK version references: ```bash -grep -rn 'Aspire.AppHost.Sdk.*Version="{PRIOR_NUGET_VERSION}"' src/frontend/src/content/docs/ \ +grep -rnE '(Aspire\.Hosting\.AppHost|Aspire\.AppHost\.Sdk).*Version="{PRIOR_NUGET_VERSION}"' src/frontend/src/content/docs/ \ --include="*.md" \ --include="*.mdx" ``` From b0cd094a135028d783dcaea6c9e54c142848db84 Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 16:27:13 -0500 Subject: [PATCH 05/12] docs: move get-started, architecture, and homepage samples to AddDotnetProject Convert tutorial, troubleshooting, MCP, console app, resource model, and resource hierarchy samples plus homepage/AppHost builder components from AddProject/addProject to AddDotnetProject/addDotnetProject. Tutorial AppHost code now matches the Aspire 17 starter template, and console-apps installs Aspire.Hosting.Dotnet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../src/components/AppHostBuilder.astro | 32 +++++++------- .../components/SimpleAppHostCode.shared.ts | 4 +- .../src/components/ThreeTierAspire.astro | 2 +- .../src/components/home/HomePage.astro | 4 +- .../content/docs/app-host/console-apps.mdx | 43 +++++++++++++------ .../architecture/resource-hierarchies.mdx | 16 +++---- .../docs/architecture/resource-model.mdx | 8 ++-- .../src/content/docs/get-started/app-host.mdx | 8 ++-- .../docs/get-started/aspire-mcp-server.mdx | 12 +++--- .../docs/get-started/deploy-first-app.mdx | 8 ++-- .../content/docs/get-started/first-app.mdx | 6 +-- .../docs/get-started/troubleshooting.mdx | 6 +-- 12 files changed, 82 insertions(+), 67 deletions(-) diff --git a/src/frontend/src/components/AppHostBuilder.astro b/src/frontend/src/components/AppHostBuilder.astro index ef6d98d6fb..79ea53c5ee 100644 --- a/src/frontend/src/components/AppHostBuilder.astro +++ b/src/frontend/src/components/AppHostBuilder.astro @@ -75,7 +75,7 @@ builder.Build().Run();`, apiFrontend: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj"); +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj"); // Add frontend service and reference the API var frontend = builder.AddViteApp("frontend", "../frontend") @@ -87,7 +87,7 @@ builder.Build().Run();`, apiFrontendContainer: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj"); +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj"); // Add frontend service and reference the API var frontend = builder.AddViteApp("frontend", "../frontend") @@ -107,7 +107,7 @@ var postgres = builder.AddPostgres("db") .AddDatabase("appdata"); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres); // Add frontend service and reference the API @@ -124,7 +124,7 @@ var postgres = builder.AddPostgres("db") .AddDatabase("appdata"); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres); // Add frontend service and reference the API @@ -162,14 +162,14 @@ builder.Build().Run();`, api: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj"); +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj"); builder.Build().Run();`, apiContainer: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj"); +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj"); // Add custom container var customContainer = builder.AddContainer("mycustomcontainer", "myregistry/myapp", "latest") @@ -184,7 +184,7 @@ var postgres = builder.AddPostgres("db") .AddDatabase("appdata"); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres); builder.Build().Run();`, @@ -196,7 +196,7 @@ var postgres = builder.AddPostgres("db") .AddDatabase("appdata"); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres); // Add custom container @@ -275,7 +275,7 @@ builder.Build().Run();`, apiFrontendDeployment: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .PublishAsAzureContainerApp(); // Add frontend service and reference the API @@ -289,7 +289,7 @@ builder.Build().Run();`, apiFrontendContainerDeployment: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .PublishAsAzureContainerApp(); // Add frontend service and reference the API @@ -314,7 +314,7 @@ var postgres = builder.AddAzurePostgresFlexibleServer("db") .RunAsContainer(); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres) .WaitFor(postgres) .PublishAsAzureContainerApp(); @@ -336,7 +336,7 @@ var postgres = builder.AddAzurePostgresFlexibleServer("db") .RunAsContainer(); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres) .WaitFor(postgres) .PublishAsAzureContainerApp(); @@ -383,7 +383,7 @@ builder.Build().Run();`, apiDeployment: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .PublishAsAzureContainerApp(); builder.Build().Run();`, @@ -391,7 +391,7 @@ builder.Build().Run();`, apiContainerDeployment: `var builder = DistributedApplication.CreateBuilder(args); // Add API service -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .PublishAsAzureContainerApp(); // Add custom container @@ -410,7 +410,7 @@ var postgres = builder.AddAzurePostgresFlexibleServer("db") .RunAsContainer(); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres) .WaitFor(postgres) .PublishAsAzureContainerApp(); @@ -426,7 +426,7 @@ var postgres = builder.AddAzurePostgresFlexibleServer("db") .RunAsContainer(); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres) .WaitFor(postgres) .PublishAsAzureContainerApp(); diff --git a/src/frontend/src/components/SimpleAppHostCode.shared.ts b/src/frontend/src/components/SimpleAppHostCode.shared.ts index 6adb5e7ae8..4d5a033abe 100644 --- a/src/frontend/src/components/SimpleAppHostCode.shared.ts +++ b/src/frontend/src/components/SimpleAppHostCode.shared.ts @@ -86,7 +86,7 @@ var postgres = builder.AddPostgres("db") .WithDataVolume(); // Add API service and reference the database -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../api/Api.csproj") .WithReference(postgres) .WaitFor(postgres); @@ -196,7 +196,7 @@ const postgres = await builder.addPostgres("db") .withDataVolume(); // Add API service and reference the database -const api = await builder.addProject("api", "../api/Api.csproj", "https") +const api = await builder.addDotnetProject("api", "../api/Api.csproj") .withReference(postgres) .waitFor(postgres); diff --git a/src/frontend/src/components/ThreeTierAspire.astro b/src/frontend/src/components/ThreeTierAspire.astro index f59e4c77a8..ef4f581e61 100644 --- a/src/frontend/src/components/ThreeTierAspire.astro +++ b/src/frontend/src/components/ThreeTierAspire.astro @@ -54,7 +54,7 @@ var postgres = builder.AddPostgres("db") .WithDataVolume(); // Add API service and reference the database -var api = builder.AddProject("api", "../api/ApiService.csproj") +var api = builder.AddDotnetProject("api", "../api/ApiService.csproj") .WithReference(postgres) .WaitFor(postgres); diff --git a/src/frontend/src/components/home/HomePage.astro b/src/frontend/src/components/home/HomePage.astro index cee67e817c..d8c53e4d4a 100644 --- a/src/frontend/src/components/home/HomePage.astro +++ b/src/frontend/src/components/home/HomePage.astro @@ -70,10 +70,10 @@ var postgres = builder.AddPostgres("postgres") var cache = builder.AddRedis("basketcache"); var catalog = builder - .AddProject("catalogservice") + .AddDotnetProject("catalogservice", "./catalog/CatalogService.csproj") .WithReference(postgres); -builder.AddProject("frontend") +builder.AddDotnetProject("frontend", "./frontend/Frontend.csproj") .WithReference(catalog) .WithReference(cache); diff --git a/src/frontend/src/content/docs/app-host/console-apps.mdx b/src/frontend/src/content/docs/app-host/console-apps.mdx index 692f8fe756..0a3a81af17 100644 --- a/src/frontend/src/content/docs/app-host/console-apps.mdx +++ b/src/frontend/src/content/docs/app-host/console-apps.mdx @@ -31,7 +31,7 @@ For example, to orchestrate a Node.js console app from a C# AppHost, choose any These examples assume an existing AppHost. -- **.NET:** The examples also assume a shared service defaults project. Create the named console, worker, and API projects before referencing them. In a C# AppHost, add project references so the corresponding `Projects.*` types are generated; in a TypeScript AppHost, use each project's actual path. +- **.NET:** The examples also assume a shared service defaults project. Create the named console, worker, and API projects before referencing them. Reference each project by its path relative to the AppHost directory. - **Node.js:** Create each app folder with a _package.json_ file before referencing it. The AppHost resolves the app folder path relative to the AppHost directory, and the script path relative to the app folder. For the Redis examples, install the hosting integration in your AppHost. Running Redis also requires a supported [container runtime](/get-started/prerequisites/). @@ -52,7 +52,22 @@ For the Redis examples, install the hosting integration in your AppHost. Running -Add the console app project to your AppHost: +Install the .NET hosting integration in your AppHost. It provides `AddDotnetProject` / `addDotnetProject`, which runs a .NET project or C# file-based app: + + + + + + + + + + + + + + +Then add the console app project to your AppHost: @@ -63,7 +78,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); // Add a console app project to the AppHost -var processor = builder.AddProject("processor") +var processor = builder.AddDotnetProject("processor", "../MyConsoleApp/MyConsoleApp.csproj") .WithReference(cache); builder.Build().Run(); @@ -81,7 +96,7 @@ const cache = await builder.addRedis('cache'); // Add a console app project to the AppHost await builder - .addProject('processor', '../MyConsoleApp/MyConsoleApp.csproj') + .addDotnetProject('processor', '../MyConsoleApp/MyConsoleApp.csproj') .withReference(cache); await builder.build().run(); @@ -258,9 +273,9 @@ Console apps using the .NET Generic Host can use the same service discovery infr ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); - var catalog = builder.AddProject("catalog"); + var catalog = builder.AddDotnetProject("catalog", "../CatalogService/CatalogService.csproj"); - var processor = builder.AddProject("processor") + var processor = builder.AddDotnetProject("processor", "../MyConsoleApp/MyConsoleApp.csproj") .WithReference(catalog) .WaitFor(catalog); @@ -275,12 +290,12 @@ Console apps using the .NET Generic Host can use the same service discovery infr const builder = await createBuilder(); - const catalog = await builder.addProject( + const catalog = await builder.addDotnetProject( 'catalog', '../CatalogService/CatalogService.csproj' ); - const processor = await builder.addProject( + const processor = await builder.addDotnetProject( 'processor', '../MyConsoleApp/MyConsoleApp.csproj' ); @@ -337,7 +352,7 @@ Node.js apps don't use the .NET service discovery resolver. Instead, they read t ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); - var catalog = builder.AddProject("catalog"); + var catalog = builder.AddDotnetProject("catalog", "../CatalogService/CatalogService.csproj"); var processor = builder.AddNodeApp("processor", "../processor", "index.js") .WithReference(catalog) @@ -354,7 +369,7 @@ Node.js apps don't use the .NET service discovery resolver. Instead, they read t const builder = await createBuilder(); - const catalog = await builder.addProject( + const catalog = await builder.addDotnetProject( 'catalog', '../CatalogService/CatalogService.csproj' ); @@ -543,7 +558,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); var db = builder.AddPostgres("postgres").AddDatabase("app-db"); -var worker = builder.AddProject("data-worker") +var worker = builder.AddDotnetProject("data-worker", "../DataWorker/DataWorker.csproj") .WithReference(cache) .WithReference(db) .WaitFor(db); @@ -563,7 +578,7 @@ const cache = await builder.addRedis('cache'); const postgres = await builder.addPostgres('postgres'); const db = await postgres.addDatabase('app-db'); -const worker = await builder.addProject( +const worker = await builder.addDotnetProject( 'data-worker', '../DataWorker/DataWorker.csproj' ); @@ -653,7 +668,7 @@ In your AppHost, add the console app project with `WithExplicitStart`: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var tool = builder.AddProject("tool") +var tool = builder.AddDotnetProject("tool", "../MyInteractiveTool/MyInteractiveTool.csproj") .WithExplicitStart(); builder.Build().Run(); @@ -667,7 +682,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const tool = await builder.addProject( +const tool = await builder.addDotnetProject( 'tool', '../MyInteractiveTool/MyInteractiveTool.csproj' ); diff --git a/src/frontend/src/content/docs/architecture/resource-hierarchies.mdx b/src/frontend/src/content/docs/architecture/resource-hierarchies.mdx index 53454ef946..680bc6f845 100644 --- a/src/frontend/src/content/docs/architecture/resource-hierarchies.mdx +++ b/src/frontend/src/content/docs/architecture/resource-hierarchies.mdx @@ -73,7 +73,7 @@ Aspire represents these relationships through a **heterogeneous Directed Acyclic var builder = DistributedApplication.CreateBuilder(args); var db = builder.AddPostgres("pg"); -var api = builder.AddProject("api").WithReference(db); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(db); var web = builder.AddJavaScriptApp("web", "../web").WithReference(api); builder.Build().Run(); @@ -276,7 +276,7 @@ These properties are dynamically resolved during the application's startup seque ### `IResourceWithEndpoints` -Resources supporting endpoints should implement `IResourceWithEndpoints`, enabling the use of `GetEndpoint(name)` to retrieve an `EndpointReference`. This is implemented on the built-in `ProjectResource`, `ContainerResource` and `ExecutableResource`. It allows endpoints to be programmatically accessed and passed between resources. +Resources supporting endpoints should implement `IResourceWithEndpoints`, enabling the use of `GetEndpoint(name)` to retrieve an `EndpointReference`. This is implemented on the built-in `ContainerResource` and `ExecutableResource` types, including `DotnetProjectResource`. It allows endpoints to be programmatically accessed and passed between resources. ```csharp title="Example — Endpoint Access and Resolution" var builder = DistributedApplication.CreateBuilder(args); @@ -380,7 +380,7 @@ var builder = DistributedApplication.CreateBuilder(args); var redis = builder.AddContainer("redis", "redis") .WithEndpoint(name: "tcp", targetPort: 6379); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(redis.GetEndpoint("tcp")); builder.Build().Run(); @@ -398,7 +398,7 @@ var builder = DistributedApplication.CreateBuilder(args); var redis = builder.AddContainer("redis", "redis") .WithEndpoint(name: "tcp", targetPort: 6379); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithEnvironment("RedisUrl", redis.GetEndpoint("tcp")); builder.Build().Run(); @@ -423,7 +423,7 @@ In C#, call `endpoint.Property(...)` to get that field. In TypeScript AppHosts, var redis = builder.AddContainer("redis", "redis") .WithEndpoint("tcp", 6379); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithEnvironment(ctx => { var ep = redis.GetEndpoint("tcp"); @@ -448,7 +448,7 @@ const redisHost = await ep.property(EndpointProperty.Host); const redisPort = await ep.property(EndpointProperty.Port); await builder - .addProject('worker', '../Worker/Worker.csproj') + .addDotnetProject('worker', '../Worker/Worker.csproj') .withEnvironment('REDIS_HOST', redisHost) .withEnvironment('REDIS_PORT', redisPort); @@ -600,7 +600,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080); var grafana = builder.AddContainer("grafana", "grafana/grafana"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment(async ctx => { var keyCloakEndpoint = keycloak.GetEndpoint("http"); @@ -636,7 +636,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080); var grafana = builder.AddContainer("grafana", "grafana/grafana"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment(ctx => { var keyCloakEndpoint = keycloak.GetEndpoint("http"); diff --git a/src/frontend/src/content/docs/architecture/resource-model.mdx b/src/frontend/src/content/docs/architecture/resource-model.mdx index 668300b39c..d74b7887ea 100644 --- a/src/frontend/src/content/docs/architecture/resource-model.mdx +++ b/src/frontend/src/content/docs/architecture/resource-model.mdx @@ -19,7 +19,7 @@ A quick example that shows the basic usage: var builder = DistributedApplication.CreateBuilder(args); var db = builder.AddPostgres("pg").AddDatabase("appdata"); -var api = builder.AddProject("api").WithReference(db); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(db); var web = builder.AddJavaScriptApp("web", "../web").WithReference(api); builder.Build().Run(); @@ -40,7 +40,7 @@ architecture-beta -1. Use `.AddXyz(...)` helper methods to add and declare resources (e.g., `.AddPostgres(...)`, `.AddProject(...)`). +1. Use `.AddXyz(...)` helper methods to add and declare resources (e.g., `.AddPostgres(...)`, `.AddDotnetProject(...)`). 1. Use `.WithReference(...)` (or similar) to represent explicit dependencies between resources. 1. Call `Build().Run()` - Aspire builds the application model (graph) and executes it handling: @@ -83,7 +83,7 @@ Annotations allow attaching additional structured information to a resource with ### Fluent extension methods -Resources are typically added using fluent **extension methods** such as `.AddRedis(...)`, `.AddProject(...)`, or `.AddPostgres(...)`. Extension methods encapsulate: +Resources are typically added using fluent **extension methods** such as `.AddRedis(...)`, `.AddDotnetProject(...)`, or `.AddPostgres(...)`. Extension methods encapsulate: - **Construction** of the resource object. - **Attachment of annotations** that describe defaults, discovery hints, or runtime behavior. @@ -107,7 +107,7 @@ To continue from the previous example, here's how you can add resources and wire var builder = DistributedApplication.CreateBuilder(args); var db = builder.AddPostgres("pg").AddDatabase("appdata"); -var api = builder.AddProject("api").WithReference(db); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(db); var web = builder.AddJavaScriptApp("web", "../web").WithReference(api); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/get-started/app-host.mdx b/src/frontend/src/content/docs/get-started/app-host.mdx index 58a544305a..3c812da580 100644 --- a/src/frontend/src/content/docs/get-started/app-host.mdx +++ b/src/frontend/src/content/docs/get-started/app-host.mdx @@ -148,10 +148,10 @@ You can represent that architecture in an AppHost like this:
-

Uses AddProject<Projects.Api>() to reference the API project.

+

Uses AddDotnetProject() to add the API project by its path.

-

Uses addProject() to reference the API project.

+

Uses addDotnetProject() to add the API project by its path.

@@ -375,7 +375,7 @@ Next, register the API service and wire it to the PostgreSQL resource with

What this does:

    -
  • AddProject<Projects.Api>("api") registers the API project as a service named api.
  • +
  • AddDotnetProject("api", "../api/Api.csproj") registers the API project as a service named api.
  • WithReference(postgres) injects connection details into the API configuration.
  • WaitFor(postgres) delays startup until PostgreSQL is healthy.
@@ -383,7 +383,7 @@ Next, register the API service and wire it to the PostgreSQL resource with

What this does:

    -
  • addProject("api", "../api/Api.csproj", "https") registers the API project as a service named api.
  • +
  • addDotnetProject("api", "../api/Api.csproj") registers the API project as a service named api.
  • withReference(postgres) wires the database dependency into the API resource.
  • waitFor(postgres) delays startup until PostgreSQL is healthy.
diff --git a/src/frontend/src/content/docs/get-started/aspire-mcp-server.mdx b/src/frontend/src/content/docs/get-started/aspire-mcp-server.mdx index 5da2f6e9be..986a033233 100644 --- a/src/frontend/src/content/docs/get-started/aspire-mcp-server.mdx +++ b/src/frontend/src/content/docs/get-started/aspire-mcp-server.mdx @@ -132,10 +132,10 @@ By default, all resources, console logs, and telemetry are accessible through th ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var apiservice = builder.AddProject("apiservice") +var apiservice = builder.AddDotnetProject("apiservice", "../AspireApp.ApiService/AspireApp.ApiService.csproj") .ExcludeFromMcp(); -builder.AddProject("webfrontend") +builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj") .WithExternalHttpEndpoints() .WithReference(apiservice); @@ -149,11 +149,11 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const apiservice = await builder - .addProject("apiservice", "./api/ApiService.csproj") + .addDotnetProject("apiservice", "./api/ApiService.csproj") .excludeFromMcp(); await builder - .addProject("webfrontend", "./web/Web.csproj") + .addDotnetProject("webfrontend", "./web/Web.csproj") .withExternalHttpEndpoints() .withReference(apiservice); @@ -223,7 +223,7 @@ If your AppHost includes dev-only resources, use `ExecutionContext.IsRunMode` to ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); if (builder.ExecutionContext.IsRunMode) { @@ -241,7 +241,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const api = await builder - .addProject("api", "./api/Api.csproj"); + .addDotnetProject("api", "./api/Api.csproj"); if (await builder.executionContext.isRunMode()) { // Only available during local development diff --git a/src/frontend/src/content/docs/get-started/deploy-first-app.mdx b/src/frontend/src/content/docs/get-started/deploy-first-app.mdx index 21788999d2..4be4118ea9 100644 --- a/src/frontend/src/content/docs/get-started/deploy-first-app.mdx +++ b/src/frontend/src/content/docs/get-started/deploy-first-app.mdx @@ -372,10 +372,10 @@ In the AppHost, use ("apiservice") + var apiService = builder.AddDotnetProject("apiservice", "../AspireApp.ApiService/AspireApp.ApiService.csproj") .WithHttpHealthCheck("/health"); - builder.AddProject("webfrontend") + builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj") .WithExternalHttpEndpoints() .WithHttpHealthCheck("/health") .WithReference(apiService) @@ -396,10 +396,10 @@ In the AppHost, use ("apiservice") + var apiService = builder.AddDotnetProject("apiservice", "../AspireApp.ApiService/AspireApp.ApiService.csproj") .WithHttpHealthCheck("/health"); - builder.AddProject("webfrontend") + builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj") .WithExternalHttpEndpoints() .WithHttpHealthCheck("/health") .WithReference(apiService) diff --git a/src/frontend/src/content/docs/get-started/first-app.mdx b/src/frontend/src/content/docs/get-started/first-app.mdx index 9e5a6f0dd6..0ba39c079e 100644 --- a/src/frontend/src/content/docs/get-started/first-app.mdx +++ b/src/frontend/src/content/docs/get-started/first-app.mdx @@ -257,10 +257,10 @@ All templates start with ("apiservice") + var apiService = builder.AddDotnetProject("apiservice", "../AspireApp.ApiService/AspireApp.ApiService.csproj") .WithHttpHealthCheck("/health"); - builder.AddProject("webfrontend") + builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj") .WithExternalHttpEndpoints() .WithHttpHealthCheck("/health") .WithReference(apiService) @@ -272,7 +272,7 @@ All templates start with creates the distributed application builder - - registers your API service and web frontend + - registers your API service and web frontend by their project paths - connects services. It injects the API's URL as an environment variable and sets up service discovery so you can use service names instead of hardcoded URLs - ensures the API is healthy before starting the frontend, preventing connection errors from race conditions - monitors service health diff --git a/src/frontend/src/content/docs/get-started/troubleshooting.mdx b/src/frontend/src/content/docs/get-started/troubleshooting.mdx index 1d1979634e..defbed9f36 100644 --- a/src/frontend/src/content/docs/get-started/troubleshooting.mdx +++ b/src/frontend/src/content/docs/get-started/troubleshooting.mdx @@ -78,7 +78,7 @@ Run [`aspire doctor`](/reference/cli/commands/aspire-doctor/) to check runtime a **Solution**: Make sure you're using in your AppHost: ```csharp title="AppHost.cs" -builder.AddProject("frontend") +builder.AddDotnetProject("frontend", "../WebFrontend/WebFrontend.csproj") .WithReference(apiService) .WaitFor(apiService); // Add this line! ``` @@ -95,7 +95,7 @@ In your AppHost: ```csharp title="AppHost.cs" var db = builder.AddPostgres("db"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(db); // This injects the connection string ``` @@ -152,7 +152,7 @@ docker pull redis:latest ```csharp title="AppHost.cs" // In AppHost -var api = builder.AddProject("apiservice"); // Name is "apiservice" +var api = builder.AddDotnetProject("apiservice", "../Api/Api.csproj"); // Name is "apiservice" ``` ```csharp title="Program.cs" From e426c8c5baa47726b32758597fba9b2da9bc1135 Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 16:34:07 -0500 Subject: [PATCH 06/12] docs: migrate remaining English samples to AddDotnetProject Convert integration, deployment, fundamentals, testing, and community samples from AddProject/AddCSharpApp to AddDotnetProject, update ProjectResource type references to DotnetProjectResource, and align the markdown rendering e2e expectation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../docs/app-host/container-registry.mdx | 52 +++++++++---------- .../docs/app-host/cors-configuration.mdx | 4 +- .../docker-compose-to-apphost-reference.mdx | 2 +- .../src/content/docs/app-host/eventing.mdx | 4 +- .../docs/app-host/executable-resources.mdx | 4 +- .../app-host/migrate-from-docker-compose.mdx | 26 +++++----- .../docs/app-host/resource-lifetimes.mdx | 8 +-- .../content/docs/app-host/resource-naming.mdx | 16 +++--- .../content/docs/app-host/with-terminal.mdx | 4 +- .../docs/community/contributor-guide.mdx | 12 ++--- .../blazor-webassembly.mdx | 8 +-- .../src/content/docs/dashboard/explore.mdx | 4 +- .../dashboard/telemetry-after-deployment.mdx | 4 +- .../content/docs/deployment/app-lifecycle.mdx | 4 +- .../docs/deployment/azure/app-service.mdx | 12 ++--- .../azure/azure-security-best-practices.mdx | 12 ++--- .../docs/deployment/azure/container-apps.mdx | 20 +++---- .../docs/deployment/azure/sandboxes.mdx | 4 +- .../docs/deployment/custom-deployments.mdx | 14 ++--- .../docs/deployment/deploy-with-aspire.mdx | 8 +-- .../docs/deployment/docker-compose.mdx | 24 ++++----- .../content/docs/deployment/environments.mdx | 12 ++--- .../deployment/kubernetes-gateway-aks.mdx | 8 +-- .../deployment/kubernetes-ingress-aks.mdx | 8 +-- .../docs/deployment/kubernetes-ingress.mdx | 8 +-- .../docs/deployment/kubernetes/clusters.mdx | 4 +- .../deployment/kubernetes/helm-charts.mdx | 12 ++--- .../kubernetes/persistent-volumes.mdx | 12 ++--- .../src/content/docs/deployment/pipelines.mdx | 18 +++---- .../docs/extensibility/custom-resources.mdx | 6 +-- .../extensibility/interaction-service.mdx | 2 +- .../multi-language-integration-authoring.mdx | 2 +- .../fundamentals/annotations-overview.mdx | 14 ++--- .../fundamentals/container-networking.mdx | 4 +- .../fundamentals/custom-resource-commands.mdx | 26 +++++----- .../fundamentals/custom-resource-urls.mdx | 11 ++-- .../fundamentals/environment-variables.mdx | 6 +-- .../docs/fundamentals/external-parameters.mdx | 32 ++++++------ .../docs/fundamentals/health-checks.mdx | 8 +-- .../docs/fundamentals/http-commands.mdx | 6 +-- .../docs/fundamentals/networking-overview.mdx | 12 ++--- .../fundamentals/persist-data-volumes.mdx | 4 +- .../docs/fundamentals/service-discovery.mdx | 30 +++++------ .../integrations/ai/ollama/ollama-host.mdx | 8 +-- .../integrations/ai/openai/openai-host.mdx | 10 ++-- .../docs/integrations/ai/squad/squad-host.mdx | 2 +- .../stable-diffusion-cpp-connect.mdx | 2 +- .../stable-diffusion-cpp-host.mdx | 2 +- .../caching/garnet/garnet-host.mdx | 12 ++--- .../redis-distributed-host.mdx | 2 +- .../integrations/caching/redis-extensions.mdx | 4 +- .../redis-output/redis-output-host.mdx | 4 +- .../integrations/caching/redis/redis-host.mdx | 22 ++++---- .../caching/valkey/valkey-host.mdx | 12 ++--- .../docs/integrations/cloud/aws/overview.mdx | 4 +- .../cloud/azure/ai-compatibility-matrix.mdx | 6 +-- .../azure-ai-foundry-host.mdx | 40 +++++++------- .../azure-ai-inference-get-started.mdx | 2 +- .../azure-ai-inference-host.mdx | 4 +- .../azure-ai-search/azure-ai-search-host.mdx | 12 ++--- .../azure-api-management-get-started.mdx | 4 +- .../azure-api-management-networking.mdx | 4 +- .../azure-app-configuration-host.mdx | 12 ++--- .../azure-app-service-host.mdx | 28 +++++----- .../azure/azure-application-insights.mdx | 8 +-- .../azure-cache-redis-host.mdx | 8 +-- .../cloud/azure/azure-connector-namespace.mdx | 4 +- .../azure-container-registry-host.mdx | 4 +- .../azure-cosmos-db/azure-cosmos-db-host.mdx | 6 +-- .../cloud/azure/azure-data-explorer.mdx | 8 +-- .../azure-event-hubs-host.mdx | 20 +++---- .../cloud/azure/azure-front-door.mdx | 14 ++--- .../azure-functions/azure-functions-host.mdx | 6 +-- .../azure-key-vault/azure-key-vault-host.mdx | 16 +++--- .../cloud/azure/azure-log-analytics.mdx | 2 +- .../azure/azure-openai/azure-openai-host.mdx | 8 +-- .../azure-postgresql-host.mdx | 12 ++--- .../azure-service-bus-host.mdx | 4 +- .../azure-signalr/azure-signalr-host.mdx | 14 ++--- .../azure-sql-database-host.mdx | 6 +-- .../azure-storage-blobs-host.mdx | 20 +++---- .../cloud/azure/azure-storage-datalake.mdx | 12 ++--- .../azure-storage-queues-host.mdx | 6 +-- .../azure-storage-tables-host.mdx | 12 ++--- .../cloud/azure/azure-virtual-network.mdx | 4 +- .../azure-web-pubsub-host.mdx | 8 +-- .../cloud/azure/configure-container-apps.mdx | 10 ++-- .../cloud/azure/container-app-jobs.mdx | 20 +++---- .../cloud/azure/customize-resources.mdx | 12 ++--- .../cloud/azure/local-provisioning.mdx | 2 +- .../integrations/cloud/azure/overview.mdx | 13 +++-- .../cloud/azure/role-assignments.mdx | 10 ++-- .../integrations/cloud/stripe/stripe-host.mdx | 8 +-- .../docs/integrations/compute/docker.mdx | 32 ++++++------ .../docs/integrations/compute/floci.mdx | 16 +++--- .../content/docs/integrations/compute/k3s.mdx | 18 +++---- .../integrations/compute/kind/kind-host.mdx | 8 +-- .../docs/integrations/compute/kubernetes.mdx | 6 +-- .../client-integrations.mdx | 2 +- .../hosting-integrations.mdx | 6 +-- .../secure-communication.mdx | 4 +- .../databases/chroma/chroma-host.mdx | 4 +- .../databases/clickhouse/clickhouse-host.mdx | 8 +-- .../databases/duckdb/duckdb-host.mdx | 12 ++--- .../azure-cosmos-db/azure-cosmos-db-host.mdx | 6 +-- .../efcore/azure-sql/azure-sql-host.mdx | 6 +-- .../databases/efcore/migrations.mdx | 18 +++---- .../databases/efcore/oracle/oracle-host.mdx | 8 +-- .../integrations/databases/efcore/sqlite.mdx | 4 +- .../elasticsearch-extensions.mdx | 2 +- .../elasticsearch/elasticsearch-host.mdx | 10 ++-- .../databases/kurrentdb/kurrentdb-host.mdx | 12 ++--- .../meilisearch/meilisearch-host.mdx | 16 +++--- .../databases/milvus/milvus-host.mdx | 10 ++-- .../databases/mongodb/mongodb-extensions.mdx | 4 +- .../databases/mongodb/mongodb-host.mdx | 14 ++--- .../databases/mysql/mysql-extensions.mdx | 12 ++--- .../databases/mysql/mysql-host.mdx | 18 +++---- .../databases/postgres/postgres-host.mdx | 20 +++---- .../postgres/postgresql-extensions.mdx | 14 ++--- .../databases/qdrant/qdrant-host.mdx | 8 +-- .../databases/ravendb/ravendb-host.mdx | 22 ++++---- .../databases/rustfs/rustfs-host.mdx | 4 +- .../seaweedfs/seaweedfs-get-started.mdx | 4 +- .../databases/seaweedfs/seaweedfs-host.mdx | 4 +- .../integrations/databases/solr/solr-host.mdx | 4 +- .../sql-server/sql-server-extensions.mdx | 12 ++--- .../databases/sql-server/sql-server-host.mdx | 14 ++--- .../databases/sqlite/sqlite-host.mdx | 12 ++--- .../databases/surrealdb/surrealdb-host.mdx | 20 +++---- .../integrations/devtools/dab/dab-host.mdx | 2 +- .../integrations/devtools/dev-tunnels.mdx | 8 +-- .../devtools/flagd/flagd-connect.mdx | 4 +- .../devtools/flagd/flagd-host.mdx | 14 ++--- .../integrations/devtools/goff/goff-host.mdx | 20 +++---- .../devtools/mailpit/mailpit-host.mdx | 8 +-- .../mcp-inspector-get-started.mdx | 4 +- .../mcp-inspector/mcp-inspector-host.mdx | 18 +++---- .../dotnet/dotnet-tool-resources.mdx | 4 +- .../content/docs/integrations/dotnet/maui.mdx | 4 +- .../docs/integrations/frameworks/bun-apps.mdx | 2 +- .../frameworks/dapr/dapr-host.mdx | 4 +- .../frameworks/dotnet/dotnet-get-started.mdx | 2 +- .../docs/integrations/frameworks/orleans.mdx | 8 +-- .../docs/integrations/frameworks/python.mdx | 12 ++--- .../messaging/activemq/activemq-host.mdx | 4 +- .../apache-kafka/apache-kafka-host.mdx | 14 ++--- .../messaging/lavinmq/lavinmq-connect.mdx | 2 +- .../messaging/lavinmq/lavinmq-host.mdx | 2 +- .../messaging/listmonk/listmonk-host.mdx | 4 +- .../mosquitto/mosquitto-get-started.mdx | 4 +- .../messaging/mosquitto/mosquitto-host.mdx | 4 +- .../integrations/messaging/nats/nats-host.mdx | 10 ++-- .../papercut-smtp-get-started.mdx | 4 +- .../papercut-smtp/papercut-smtp-host.mdx | 4 +- .../messaging/posta/posta-get-started.mdx | 4 +- .../messaging/posta/posta-host.mdx | 4 +- .../messaging/rabbitmq/rabbitmq-host.mdx | 12 ++--- .../redpanda/redpanda-get-started.mdx | 4 +- .../messaging/redpanda/redpanda-host.mdx | 4 +- .../messaging/sftp/sftp-get-started.mdx | 4 +- .../integrations/messaging/sftp/sftp-host.mdx | 4 +- .../opentelemetry-collector-get-started.mdx | 4 +- .../opentelemetry-collector-host.mdx | 8 +-- .../observability/seq/seq-host.mdx | 8 +-- .../content/docs/integrations/overview.mdx | 4 +- .../ngrok/ngrok-get-started.mdx | 4 +- .../reverse-proxies/ngrok/ngrok-host.mdx | 4 +- .../integrations/reverse-proxies/yarp.mdx | 28 +++++----- .../bitwarden-secret-manager-host.mdx | 22 ++++---- .../docs/integrations/security/keycloak.mdx | 32 ++++++------ .../security/logto/logto-get-started.mdx | 4 +- .../security/logto/logto-host.mdx | 4 +- .../security/zitadel/zitadel-connect.mdx | 4 +- .../docs/testing/advanced-scenarios.mdx | 8 +-- .../tests/e2e/markdown-rendering.spec.ts | 2 +- 176 files changed, 848 insertions(+), 848 deletions(-) diff --git a/src/frontend/src/content/docs/app-host/container-registry.mdx b/src/frontend/src/content/docs/app-host/container-registry.mdx index 28809f66e4..bcca6e0331 100644 --- a/src/frontend/src/content/docs/app-host/container-registry.mdx +++ b/src/frontend/src/content/docs/app-host/container-registry.mdx @@ -40,7 +40,7 @@ var builder = DistributedApplication.CreateBuilder(args); var registry = builder.AddContainerRegistry("myregistry", "registry.example.com"); // Associate the registry with a project -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(registry); builder.Build().Run(); @@ -56,7 +56,7 @@ const builder = await createBuilder(); const registry = await builder.addContainerRegistry("myregistry", "registry.example.com"); // Associate the registry with a project -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(registry); await builder.build().run(); @@ -81,7 +81,7 @@ var builder = DistributedApplication.CreateBuilder(args); var registry = builder.AddContainerRegistry("dockerhub", "docker.io"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(registry); ```
@@ -93,7 +93,7 @@ const builder = await createBuilder(); const registry = await builder.addContainerRegistry("dockerhub", "docker.io"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(registry); ```
@@ -110,7 +110,7 @@ var builder = DistributedApplication.CreateBuilder(args); var registry = builder.AddContainerRegistry("ghcr", "ghcr.io"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(registry); ```
@@ -122,7 +122,7 @@ const builder = await createBuilder(); const registry = await builder.addContainerRegistry("ghcr", "ghcr.io"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(registry); ```
@@ -141,7 +141,7 @@ var registry = builder.AddContainerRegistry( "private-registry", "registry.mycompany.com:5000"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(registry); ```
@@ -155,7 +155,7 @@ const registry = await builder.addContainerRegistry( "private-registry", "registry.mycompany.com:5000"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(registry); ```
@@ -182,7 +182,7 @@ var registry = builder.AddContainerRegistry( registryEndpoint, registryRepository); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(registry); ``` @@ -200,7 +200,7 @@ const registry = await builder.addContainerRegistry( registryEndpoint, registryRepository); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(registry); ``` @@ -265,7 +265,7 @@ var builder = DistributedApplication.CreateBuilder(args); var environment = builder.AddAzureContainerAppEnvironment("myenv"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(environment); builder.Build().Run(); @@ -279,7 +279,7 @@ const builder = await createBuilder(); const environment = await builder.addAzureContainerAppEnvironment("myenv"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(environment); await builder.build().run(); @@ -320,7 +320,7 @@ var acr = builder.AddAzureContainerRegistry("my-acr") builder.AddAzureContainerAppEnvironment("env") .WithAzureContainerRegistry(acr); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(acr); ``` @@ -339,7 +339,7 @@ await acr.publishAsExisting(registryName, rgName); const environment = await builder.addAzureContainerAppEnvironment("env"); await environment.withAzureContainerRegistry(acr); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(acr); ``` @@ -420,10 +420,10 @@ var privateRegistry = builder.AddContainerRegistry( "private", "registry.company.com"); -var publicApi = builder.AddProject("public-api") +var publicApi = builder.AddDotnetProject("public-api", "../PublicApi/PublicApi.csproj") .WithContainerRegistry(publicRegistry); -var internalApi = builder.AddProject("internal-api") +var internalApi = builder.AddDotnetProject("internal-api", "../InternalApi/InternalApi.csproj") .WithContainerRegistry(privateRegistry); ``` @@ -438,10 +438,10 @@ const privateRegistry = await builder.addContainerRegistry( "private", "registry.company.com"); -const publicApi = await builder.addProject("public-api", "../PublicApi/PublicApi.csproj"); +const publicApi = await builder.addDotnetProject("public-api", "../PublicApi/PublicApi.csproj"); await publicApi.withContainerRegistry(publicRegistry); -const internalApi = await builder.addProject("internal-api", "../InternalApi/InternalApi.csproj"); +const internalApi = await builder.addDotnetProject("internal-api", "../InternalApi/InternalApi.csproj"); await internalApi.withContainerRegistry(privateRegistry); ``` @@ -464,10 +464,10 @@ var registry = builder.AddContainerRegistry( registryEndpoint, registryRepository); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithContainerRegistry(registry); -var worker = builder.AddProject("worker") +var worker = builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithContainerRegistry(registry); builder.Build().Run(); @@ -487,10 +487,10 @@ const registry = await builder.addContainerRegistry( registryEndpoint, registryRepository); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withContainerRegistry(registry); -const worker = await builder.addProject("worker", "../Worker/Worker.csproj"); +const worker = await builder.addDotnetProject("worker", "../Worker/Worker.csproj"); await worker.withContainerRegistry(registry); await builder.build().run(); @@ -532,12 +532,12 @@ var acaEnv = builder.AddAzureContainerAppEnvironment("production"); var cache = builder.AddRedis("cache"); // Add API with registry configuration -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache) .WithContainerRegistry(acaEnv); // Add frontend with registry configuration -var web = builder.AddProject("web") +var web = builder.AddDotnetProject("web", "../Web/Web.csproj") .WithReference(api) .WithContainerRegistry(acaEnv); @@ -557,12 +557,12 @@ const environment = await builder.addAzureContainerAppEnvironment("production"); const cache = await builder.addRedis("cache"); // Add API with registry configuration -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(cache); await api.withContainerRegistry(environment); // Add frontend with registry configuration -const web = await builder.addProject("web", "../Web/Web.csproj"); +const web = await builder.addDotnetProject("web", "../Web/Web.csproj"); await web.withReference(api); await web.withContainerRegistry(environment); diff --git a/src/frontend/src/content/docs/app-host/cors-configuration.mdx b/src/frontend/src/content/docs/app-host/cors-configuration.mdx index 6309eed803..7cfbac17a7 100644 --- a/src/frontend/src/content/docs/app-host/cors-configuration.mdx +++ b/src/frontend/src/content/docs/app-host/cors-configuration.mdx @@ -250,7 +250,7 @@ var builder = DistributedApplication.CreateBuilder(args); var frontend = builder.AddJavaScriptApp("frontend", "../frontend", "dev") .WithHttpEndpoint(port: 3000, env: "PORT"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(frontend) // Injects services__frontend__http__0 into the API .WithExternalHttpEndpoints(); @@ -270,7 +270,7 @@ const frontend = await builder.addJavaScriptApp('frontend', '../frontend', { }); await frontend.withHttpEndpoint({ port: 3000, env: 'PORT' }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(frontend); // Injects services__frontend__http__0 into the API await api.withExternalHttpEndpoints(); diff --git a/src/frontend/src/content/docs/app-host/docker-compose-to-apphost-reference.mdx b/src/frontend/src/content/docs/app-host/docker-compose-to-apphost-reference.mdx index fa440161dc..cc84511171 100644 --- a/src/frontend/src/content/docs/app-host/docker-compose-to-apphost-reference.mdx +++ b/src/frontend/src/content/docs/app-host/docker-compose-to-apphost-reference.mdx @@ -49,7 +49,7 @@ Learn more about [Docker Compose pull_policy](https://docs.docker.com/reference/ | Docker Compose | Aspire | Notes | |----------------|-------------|-------| -| `build: ./MyApi` (for .NET) | `builder.AddProject("myapi")` | Direct .NET project reference | +| `build: ./MyApi` (for .NET) | `builder.AddDotnetProject("myapi", "../MyApi/MyApi.csproj")` | Direct .NET project reference | Learn more about [adding .NET projects](/get-started/app-host/). diff --git a/src/frontend/src/content/docs/app-host/eventing.mdx b/src/frontend/src/content/docs/app-host/eventing.mdx index f45685daa8..cbdc4c6a3b 100644 --- a/src/frontend/src/content/docs/app-host/eventing.mdx +++ b/src/frontend/src/content/docs/app-host/eventing.mdx @@ -220,9 +220,9 @@ cache.OnConnectionStringAvailable( return Task.CompletedTask; }); -var apiService = builder.AddProject("apiservice"); +var apiService = builder.AddDotnetProject("apiservice", "../AspireApp.ApiService/AspireApp.ApiService.csproj"); -builder.AddProject("webfrontend") +builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj") .WithExternalHttpEndpoints() .WithReference(cache) .WaitFor(cache) diff --git a/src/frontend/src/content/docs/app-host/executable-resources.mdx b/src/frontend/src/content/docs/app-host/executable-resources.mdx index 118f282e60..b21858ce6e 100644 --- a/src/frontend/src/content/docs/app-host/executable-resources.mdx +++ b/src/frontend/src/content/docs/app-host/executable-resources.mdx @@ -175,7 +175,7 @@ Here's a complete example using the [Vercel CLI](https://vercel.com/docs/cli) to var builder = DistributedApplication.CreateBuilder(args); // Backend API -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints(); // Frontend with Vercel CLI @@ -194,7 +194,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); // Backend API -const api = await builder.addProject("api", "./Api/Api.csproj") +const api = await builder.addDotnetProject("api", "./Api/Api.csproj") .withExternalHttpEndpoints(); // Frontend with Vercel CLI diff --git a/src/frontend/src/content/docs/app-host/migrate-from-docker-compose.mdx b/src/frontend/src/content/docs/app-host/migrate-from-docker-compose.mdx index c69a2f18d4..fa0c15a4ec 100644 --- a/src/frontend/src/content/docs/app-host/migrate-from-docker-compose.mdx +++ b/src/frontend/src/content/docs/app-host/migrate-from-docker-compose.mdx @@ -110,14 +110,14 @@ var database = builder.AddPostgres("postgres") .AddDatabase("myapp"); // Add the API project with proper dependencies -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../MyApp.Api/MyApp.Api.csproj") .WithHttpEndpoint(port: 5000) .WithHttpHealthCheck("/health") .WithReference(database, "DefaultConnection") .WaitFor(database); // Add the frontend project with dependencies -var frontend = builder.AddProject("frontend") +var frontend = builder.AddDotnetProject("frontend", "../MyApp.Frontend/MyApp.Frontend.csproj") .WithHttpEndpoint(port: 3000) .WithReference(api) .WithEnvironment("API_URL", api.GetEndpoint("http")) @@ -139,14 +139,14 @@ const database = (await builder.addPostgres("postgres") .addDatabase("myapp"); // Add the API project with proper dependencies -const api = await builder.addProject("api", "./MyApp.Api/MyApp.Api.csproj") +const api = await builder.addDotnetProject("api", "./MyApp.Api/MyApp.Api.csproj") .withHttpEndpoint({ port: 5000 }) .withHttpHealthCheck("/health") .withReference(database, "DefaultConnection") .waitFor(database); // Add the frontend project with dependencies -const frontend = await builder.addProject("frontend", "./MyApp.Frontend/MyApp.Frontend.csproj") +const frontend = await builder.addDotnetProject("frontend", "./MyApp.Frontend/MyApp.Frontend.csproj") .withHttpEndpoint({ port: 3000 }) .withReference(api) .withEnvironment("API_URL", api.getEndpoint("http")) @@ -158,12 +158,12 @@ await builder.build().run();
**Key differences explained:** -- **Build vs. project** — Docker Compose `build:` services become `AddProject()` for .NET apps, which runs them directly instead of in containers +- **Build vs. project** — Docker Compose `build:` services become `AddDotnetProject` resources for .NET apps, which runs them directly instead of in containers - **Ports** — Both examples explicitly map ports (3000 and 5000) - **Startup order** — Docker Compose uses `depends_on` with health conditions; Aspire uses for startup ordering - **Service discovery** — only configures service discovery and connection strings; it doesn't control startup order @@ -527,7 +527,7 @@ Successfully migrating from Docker Compose to Aspire requires a systematic appro - **Add backing services** like PostgreSQL, Redis with specific versions using `WithImageTag()` - **Add persistent storage** using `WithDataVolume()` where needed - - **Convert .NET applications** to project references with `AddProject()` for better integration + - **Convert .NET applications** to `AddDotnetProject` resources for better integration - **Convert Dockerfile-built containers** using `AddDockerfile()` to match `build:` directives - **Convert pre-built images** using `AddContainer()` to match `image:` directives - **Configure dependencies** with `WithReference()` for service discovery @@ -604,14 +604,14 @@ const app = await builder.addContainer("app", "myapp:latest") ```csharp title="AppHost.cs" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(database) // Service discovery .WaitFor(database); // Startup ordering ``` ```typescript title="apphost.mts" -const api = await builder.addProject("api", "./Api/Api.csproj", "https") +const api = await builder.addDotnetProject("api", "./Api/Api.csproj", { launchProfileName: "https" }) .withReference(database) // Service discovery .waitFor(database); // Startup ordering ``` @@ -654,13 +654,13 @@ Docker Compose health checks use shell commands. Aspire integrations (like Postg ```csharp title="AppHost.cs" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithHttpHealthCheck("/health"); ``` ```typescript title="apphost.mts" -const api = await builder.addProject("api", "./Api/Api.csproj", "https") +const api = await builder.addDotnetProject("api", "./Api/Api.csproj", { launchProfileName: "https" }) .withHttpHealthCheck("/health"); ``` @@ -683,7 +683,7 @@ var rabbit = builder.AddContainer("rabbitmq", "rabbitmq", "4.1.4-management-alpi .WithHealthCheck("rabbitmq-health"); // WaitFor uses the registered health check to determine readiness -var app = builder.AddProject("app") +var app = builder.AddDotnetProject("app", "../App/App.csproj") .WaitFor(rabbit); ``` @@ -693,7 +693,7 @@ const rabbit = await builder.addContainer("rabbitmq", "rabbitmq", "4.1.4-managem .withHealthCheck("rabbitmq-health"); // WaitFor uses the registered health check to determine readiness -const app = await builder.addProject("app", "./App/App.csproj", "https") +const app = await builder.addDotnetProject("app", "./App/App.csproj", { launchProfileName: "https" }) .waitFor(rabbit); ``` diff --git a/src/frontend/src/content/docs/app-host/resource-lifetimes.mdx b/src/frontend/src/content/docs/app-host/resource-lifetimes.mdx index 22214da3de..1cb9599393 100644 --- a/src/frontend/src/content/docs/app-host/resource-lifetimes.mdx +++ b/src/frontend/src/content/docs/app-host/resource-lifetimes.mdx @@ -148,7 +148,7 @@ var postgres = builder.AddPostgres("postgres") var db = postgres.AddDatabase("inventorydb"); -builder.AddProject("inventory") +builder.AddDotnetProject("inventory", "../InventoryService/InventoryService.csproj") .WithReference(db); builder.Build().Run(); @@ -168,7 +168,7 @@ await postgres.withDataVolume(); const db = postgres.addDatabase('inventorydb'); -const inventory = await builder.addProject( +const inventory = await builder.addDotnetProject( 'inventory', './InventoryService/InventoryService.csproj' ); @@ -231,7 +231,7 @@ Project resources can use persistent lifetimes when you want the project process ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithPersistentLifetime(); builder.Build().Run(); @@ -245,7 +245,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject('api', '../ApiService/ApiService.csproj'); +const api = await builder.addDotnetProject('api', '../ApiService/ApiService.csproj'); await api.withPersistentLifetime(); await builder.build().run(); diff --git a/src/frontend/src/content/docs/app-host/resource-naming.mdx b/src/frontend/src/content/docs/app-host/resource-naming.mdx index 37ac26f44d..acf4569f2d 100644 --- a/src/frontend/src/content/docs/app-host/resource-naming.mdx +++ b/src/frontend/src/content/docs/app-host/resource-naming.mdx @@ -42,7 +42,7 @@ const builder = await createBuilder(); const cache = await builder.addRedis('cache'); -await builder.addProject('api', '../MyApi/MyApi.csproj').withReference(cache); +await builder.addDotnetProject('api', '../MyApi/MyApi.csproj').withReference(cache); await builder.build().run(); ``` @@ -55,7 +55,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj") .WithReference(cache); builder.Build().Run(); @@ -107,12 +107,12 @@ const builder = await createBuilder(); const postgres = await builder.addPostgres('postgres'); const db = await postgres.addDatabase('app-db'); -const catalog = await builder.addProject( +const catalog = await builder.addDotnetProject( 'catalog-api', '../CatalogApi/CatalogApi.csproj' ); -const worker = await builder.addProject('worker', '../Worker/Worker.csproj'); +const worker = await builder.addDotnetProject('worker', '../Worker/Worker.csproj'); await worker.withReference(db); await worker.withReference(catalog); @@ -126,9 +126,9 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var db = builder.AddPostgres("postgres").AddDatabase("app-db"); -var catalog = builder.AddProject("catalog-api"); +var catalog = builder.AddDotnetProject("catalog-api", "../CatalogApi/CatalogApi.csproj"); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(db) .WithReference(catalog); @@ -203,7 +203,7 @@ const appDb = await postgres.addDatabase('app-db'); const cache = await builder.addRedis('cache'); const messageBus = await builder.addRabbitMQ('message-bus'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(appDb); await api.withReference(cache); await api.withReference(messageBus); @@ -222,7 +222,7 @@ var appDb = postgres.AddDatabase("app-db"); var cache = builder.AddRedis("cache"); var messageBus = builder.AddRabbitMQ("message-bus"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(appDb) .WithReference(cache) .WithReference(messageBus); diff --git a/src/frontend/src/content/docs/app-host/with-terminal.mdx b/src/frontend/src/content/docs/app-host/with-terminal.mdx index 23863cb695..e7461511bf 100644 --- a/src/frontend/src/content/docs/app-host/with-terminal.mdx +++ b/src/frontend/src/content/docs/app-host/with-terminal.mdx @@ -182,7 +182,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); await builder - .addProject('agent', '../Agent/Agent.csproj') + .addDotnetProject('agent', '../Agent/Agent.csproj') .withReplicas(3) .withTerminal(); @@ -198,7 +198,7 @@ Add a project reference to `Agent.csproj` in your AppHost before using its gener #pragma warning disable ASPIRETERMINAL001 var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("agent") +builder.AddDotnetProject("agent", "../Agent/Agent.csproj") .WithReplicas(3) .WithTerminal(); diff --git a/src/frontend/src/content/docs/community/contributor-guide.mdx b/src/frontend/src/content/docs/community/contributor-guide.mdx index 59b8673585..e3d3ef8549 100644 --- a/src/frontend/src/content/docs/community/contributor-guide.mdx +++ b/src/frontend/src/content/docs/community/contributor-guide.mdx @@ -392,7 +392,7 @@ Use triple backticks with a language identifier for syntax highlighting: ````md title="src/content/docs/example.md" ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("apiservice"); +builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj"); ``` ```` @@ -400,7 +400,7 @@ Renders as: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("apiservice"); +builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj"); ``` To add a title to a code block, use this syntax: @@ -408,7 +408,7 @@ To add a title to a code block, use this syntax: ````md title="src/content/docs/example.md" ```csharp title="Program.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("apiservice"); +builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj"); ``` ```` @@ -416,7 +416,7 @@ Renders as: ```csharp title="Program.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("apiservice"); +builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj"); ``` ### Blockquotes @@ -808,7 +808,7 @@ const builder = await createBuilder(); const cache = await builder.addRedis("cache"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(cache); await builder.build().run(); @@ -822,7 +822,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/dashboard/enable-browser-telemetry/blazor-webassembly.mdx b/src/frontend/src/content/docs/dashboard/enable-browser-telemetry/blazor-webassembly.mdx index 1cb2ccdc85..abeae7b30c 100644 --- a/src/frontend/src/content/docs/dashboard/enable-browser-telemetry/blazor-webassembly.mdx +++ b/src/frontend/src/content/docs/dashboard/enable-browser-telemetry/blazor-webassembly.mdx @@ -19,7 +19,7 @@ For a standalone Blazor WebAssembly project, add the WASM project resource, refe ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var weatherApi = builder.AddProject("weatherapi"); +var weatherApi = builder.AddDotnetProject("weatherapi", "../WeatherApi/WeatherApi.csproj"); var blazorApp = builder.AddBlazorWasmProject("app") .WithReference(weatherApi); @@ -40,7 +40,7 @@ import { createBuilder, OtlpProtocol } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const weatherApi = await builder.addProject( +const weatherApi = await builder.addDotnetProject( 'weatherapi', '../WeatherApi/WeatherApi.csproj' ); @@ -73,9 +73,9 @@ For a Blazor Web App that hosts an Interactive WebAssembly client, configure the ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var weatherApi = builder.AddProject("weatherapi"); +var weatherApi = builder.AddDotnetProject("weatherapi", "../WeatherApi/WeatherApi.csproj"); -builder.AddProject("blazorapp") +builder.AddDotnetProject("blazorapp", "../BlazorWeb/BlazorWeb.csproj") .ProxyBlazorService(weatherApi) .ProxyBlazorTelemetry(); diff --git a/src/frontend/src/content/docs/dashboard/explore.mdx b/src/frontend/src/content/docs/dashboard/explore.mdx index b9c7e7b5e2..34644d2ddf 100644 --- a/src/frontend/src/content/docs/dashboard/explore.mdx +++ b/src/frontend/src/content/docs/dashboard/explore.mdx @@ -287,10 +287,10 @@ By default, the resource list is ordered by resource type and then by name. To c #pragma warning disable ASPIRERESOURCETRAITS001 var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithDisplayOrder(10); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithDisplayOrder(5); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/dashboard/telemetry-after-deployment.mdx b/src/frontend/src/content/docs/dashboard/telemetry-after-deployment.mdx index ba3a52380d..9a5a6ccad7 100644 --- a/src/frontend/src/content/docs/dashboard/telemetry-after-deployment.mdx +++ b/src/frontend/src/content/docs/dashboard/telemetry-after-deployment.mdx @@ -59,10 +59,10 @@ var builder = DistributedApplication.CreateBuilder(args); var insights = builder.AddAzureApplicationInsights("app-insights"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../MyApp.ApiService/MyApp.ApiService.csproj") .WithReference(insights); -builder.AddProject("webfrontend") +builder.AddDotnetProject("webfrontend", "../MyApp.Web/MyApp.Web.csproj") .WithReference(insights) .WithExternalHttpEndpoints(); diff --git a/src/frontend/src/content/docs/deployment/app-lifecycle.mdx b/src/frontend/src/content/docs/deployment/app-lifecycle.mdx index ae9dd55efa..65f66f5580 100644 --- a/src/frontend/src/content/docs/deployment/app-lifecycle.mdx +++ b/src/frontend/src/content/docs/deployment/app-lifecycle.mdx @@ -82,7 +82,7 @@ var sqlDatabase = sqlserver.AddDatabase("sqldb"); //Add the Blazor web app with reference to the database //Deploy as a docker image with a volume mount for user upload files -var blazorweb = builder.AddProject("blazorweb") +var blazorweb = builder.AddDotnetProject("blazorweb", "../VolumeMount.BlazorWeb/VolumeMount.BlazorWeb.csproj") .WithExternalHttpEndpoints() .WithReference(sqlDatabase) .WaitFor(sqlDatabase) @@ -148,7 +148,7 @@ const sqlServer = await builder const sqlDatabase = await sqlServer.addDatabase('sqldb'); -const blazorWeb = await builder.addProject( +const blazorWeb = await builder.addDotnetProject( 'blazorweb', '../VolumeMount.BlazorWeb/VolumeMount.BlazorWeb.csproj' ); diff --git a/src/frontend/src/content/docs/deployment/azure/app-service.mdx b/src/frontend/src/content/docs/deployment/azure/app-service.mdx index d2c0cdf318..e0219a9a61 100644 --- a/src/frontend/src/content/docs/deployment/azure/app-service.mdx +++ b/src/frontend/src/content/docs/deployment/azure/app-service.mdx @@ -181,7 +181,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureAppServiceEnvironment("app-service-env"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsAzureAppServiceWebsite((infrastructure, website) => { website.AppSettings.Add("ASPNETCORE_ENVIRONMENT", new AppServiceConfigurationSetting @@ -206,7 +206,7 @@ const builder = await createBuilder(); await builder.addAzureAppServiceEnvironment("app-service-env"); await builder - .addProject("api", "../Api/Api.csproj") + .addDotnetProject("api", "../Api/Api.csproj") .publishAsAzureAppServiceWebsite({ configure: async (_infrastructure, _website) => { // Customize the generated production website here. @@ -231,7 +231,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureAppServiceEnvironment("app-service-env") .WithDeploymentSlot("staging"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsAzureAppServiceWebsite( configure: (infrastructure, website) => { @@ -256,7 +256,7 @@ await builder.addAzureAppServiceEnvironment("app-service-env") .withDeploymentSlot("staging"); await builder - .addProject("api", "../Api/Api.csproj") + .addDotnetProject("api", "../Api/Api.csproj") .publishAsAzureAppServiceWebsite({ configureSlot: async (_infrastructure, _slot) => { // Customize the generated deployment slot here. @@ -276,7 +276,7 @@ Azure App Service application settings accept only letters, numbers, and undersc ```csharp title="AppHost.cs" -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsAzureAppServiceWebsite() .SkipEnvironmentVariableNameChecks(); ``` @@ -284,7 +284,7 @@ builder.AddProject("api") ```typescript title="apphost.mts" await builder - .addProject("api", "../Api/Api.csproj", "https") + .addDotnetProject("api", "../Api/Api.csproj", { launchProfileName: "https" }) .publishAsAzureAppServiceWebsite() .skipEnvironmentVariableNameChecks(); ``` diff --git a/src/frontend/src/content/docs/deployment/azure/azure-security-best-practices.mdx b/src/frontend/src/content/docs/deployment/azure/azure-security-best-practices.mdx index e4db7f14a3..712f8b143d 100644 --- a/src/frontend/src/content/docs/deployment/azure/azure-security-best-practices.mdx +++ b/src/frontend/src/content/docs/deployment/azure/azure-security-best-practices.mdx @@ -125,7 +125,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keyVault = builder.AddAzureKeyVault("key-vault"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(keyVault); builder.Build().Run(); @@ -138,7 +138,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const keyVault = await builder.addAzureKeyVault("key-vault"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(keyVault); await builder.build().run(); @@ -159,7 +159,7 @@ var builder = DistributedApplication.CreateBuilder(args); var identity = builder.AddAzureUserAssignedIdentity("app-identity"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithAzureUserAssignedIdentity(identity); builder.Build().Run(); @@ -172,7 +172,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const identity = await builder.addAzureUserAssignedIdentity("app-identity"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withAzureUserAssignedIdentity(identity); await builder.build().run(); @@ -193,7 +193,7 @@ var builder = DistributedApplication.CreateBuilder(args); var appInsights = builder.AddAzureApplicationInsights("monitoring"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(appInsights); builder.Build().Run(); @@ -206,7 +206,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const appInsights = await builder.addAzureApplicationInsights("monitoring"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(appInsights); await builder.build().run(); diff --git a/src/frontend/src/content/docs/deployment/azure/container-apps.mdx b/src/frontend/src/content/docs/deployment/azure/container-apps.mdx index afd268e72d..c726cad72b 100644 --- a/src/frontend/src/content/docs/deployment/azure/container-apps.mdx +++ b/src/frontend/src/content/docs/deployment/azure/container-apps.mdx @@ -203,7 +203,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureContainerAppEnvironment("env"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsAzureContainerApp((infrastructure, app) => { app.Template.Scale.MinReplicas = 1; @@ -221,7 +221,7 @@ const builder = await createBuilder(); await builder.addAzureContainerAppEnvironment("env"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.publishAsAzureContainerApp(async (_infrastructure, _app) => { // Customize the generated Container App here. }); @@ -245,7 +245,7 @@ var certificateName = builder.AddParameter("certificateName"); builder.AddAzureContainerAppEnvironment("env"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsAzureContainerApp((infrastructure, app) => { app.ConfigureCustomDomain(customDomain, certificateName); @@ -266,7 +266,7 @@ const certificateName = await builder.addParameter("certificateName"); await builder.addAzureContainerAppEnvironment("env"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.publishAsAzureContainerApp(async (_infrastructure, app) => { await app.configureCustomDomain(customDomain, certificateName); }); @@ -284,13 +284,13 @@ Services deployed to Azure Container Apps use internal DNS for service discovery ```csharp title="AppHost.cs" -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints(); ``` ```typescript title="apphost.mts" -const api = await builder.addProject("api", "../Api/Api.csproj", "http"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj", { launchProfileName: "http" }); await api.withExternalHttpEndpoints(); ``` @@ -384,10 +384,10 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureContainerAppEnvironment("aspire-env") .AsExpress(); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints(); -builder.AddProject("frontend") +builder.AddDotnetProject("frontend", "../Frontend/Frontend.csproj") .WithExternalHttpEndpoints() .WithReference(api); @@ -403,10 +403,10 @@ const builder = await createBuilder(); const env = await builder.addAzureContainerAppEnvironment("aspire-env"); await env.asExpress(); -const api = await builder.addCSharpApp("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withExternalHttpEndpoints(); -const frontend = await builder.addCSharpApp("frontend", "../Frontend/Frontend.csproj"); +const frontend = await builder.addDotnetProject("frontend", "../Frontend/Frontend.csproj"); await frontend.withExternalHttpEndpoints(); await frontend.withReference(api); diff --git a/src/frontend/src/content/docs/deployment/azure/sandboxes.mdx b/src/frontend/src/content/docs/deployment/azure/sandboxes.mdx index b7a80d7049..0ecef63156 100644 --- a/src/frontend/src/content/docs/deployment/azure/sandboxes.mdx +++ b/src/frontend/src/content/docs/deployment/azure/sandboxes.mdx @@ -219,7 +219,7 @@ const aca = await builder.addAzureContainerAppEnvironment("aca"); const sandboxes = await builder.addAzureSandboxGroup("sandboxes"); await builder - .addProject("api", "../Api/Api.csproj") + .addDotnetProject("api", "../Api/Api.csproj") .withComputeEnvironment(aca); await builder @@ -241,7 +241,7 @@ var builder = DistributedApplication.CreateBuilder(args); var aca = builder.AddAzureContainerAppEnvironment("aca"); var sandboxes = builder.AddAzureSandboxGroup("sandboxes"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithComputeEnvironment(aca); builder.AddDockerfile("worker", "./worker") diff --git a/src/frontend/src/content/docs/deployment/custom-deployments.mdx b/src/frontend/src/content/docs/deployment/custom-deployments.mdx index 5b5f3b8397..d42991692a 100644 --- a/src/frontend/src/content/docs/deployment/custom-deployments.mdx +++ b/src/frontend/src/content/docs/deployment/custom-deployments.mdx @@ -143,7 +143,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("redis"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache) .WithContainerBuildOptions(options => { @@ -179,20 +179,20 @@ private static async Task PublishAsync(PipelineStepContext context) var imageManager = context.Services.GetRequiredService(); var reportingStep = context.ReportingStep; - var projectResources = context.Model.Resources - .OfType() + var imageResources = context.Model.Resources + .Where(resource => resource.RequiresImageBuild()) .ToList(); - if (projectResources.Count > 0) + if (imageResources.Count > 0) { var buildTask = await reportingStep.CreateTaskAsync( - $"Building {projectResources.Count} container image(s)", + $"Building {imageResources.Count} container image(s)", context.CancellationToken); - await imageManager.BuildImagesAsync(projectResources, context.CancellationToken); + await imageManager.BuildImagesAsync(imageResources, context.CancellationToken); await buildTask.SucceedAsync( - $"Built {projectResources.Count} image(s) successfully", + $"Built {imageResources.Count} image(s) successfully", context.CancellationToken); } else diff --git a/src/frontend/src/content/docs/deployment/deploy-with-aspire.mdx b/src/frontend/src/content/docs/deployment/deploy-with-aspire.mdx index aa715cfc1c..72322e20e3 100644 --- a/src/frontend/src/content/docs/deployment/deploy-with-aspire.mdx +++ b/src/frontend/src/content/docs/deployment/deploy-with-aspire.mdx @@ -27,7 +27,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddDockerComposeEnvironment("env"); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../Api/Api.csproj"); builder.Build().Run(); @@ -41,7 +41,7 @@ const builder = await createBuilder(); await builder.addDockerComposeEnvironment('env'); -await builder.addProject('api', '../Api/Api.csproj'); +await builder.addDotnetProject('api', '../Api/Api.csproj'); await builder.build().run(); ``` @@ -104,7 +104,7 @@ var builder = DistributedApplication.CreateBuilder(args); var apiKey = builder.AddParameter("apiKey", secret: true); builder.AddDockerComposeEnvironment("env"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment("API_KEY", apiKey); builder.Build().Run(); @@ -120,7 +120,7 @@ const builder = await createBuilder(); const apiKey = await builder.addParameter('apiKey', { secret: true }); await builder.addDockerComposeEnvironment('env'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withEnvironment('API_KEY', apiKey); await builder.build().run(); diff --git a/src/frontend/src/content/docs/deployment/docker-compose.mdx b/src/frontend/src/content/docs/deployment/docker-compose.mdx index 7d6091e020..d4cee203e4 100644 --- a/src/frontend/src/content/docs/deployment/docker-compose.mdx +++ b/src/frontend/src/content/docs/deployment/docker-compose.mdx @@ -67,7 +67,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddDockerComposeEnvironment("env"); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../Api/Api.csproj"); // After adding all resources, run the app... builder.Build().Run(); @@ -81,7 +81,7 @@ const builder = await createBuilder(); await builder.addDockerComposeEnvironment('env'); -await builder.addProject('api', '../Api/Api.csproj'); +await builder.addDotnetProject('api', '../Api/Api.csproj'); await builder.build().run(); ``` @@ -357,7 +357,7 @@ builder.AddDockerComposeEnvironment("env") api.PullPolicy = "always"; }); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../Api/Api.csproj"); builder.Build().Run(); ``` @@ -376,7 +376,7 @@ await compose.configureComposeFile(async (composeFile) => { await api.pullPolicy.set('always'); }); -await builder.addProject('api', '../Api/Api.csproj', 'http'); +await builder.addDotnetProject('api', '../Api/Api.csproj', { launchProfileName: 'http' }); await builder.build().run(); ``` @@ -523,7 +523,7 @@ Use { service.Name = "api"; }) .WithRemoteImageName("myorg/myapi") @@ -539,7 +539,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set('api'); }); @@ -559,7 +559,7 @@ For more complex scenarios, use { service.Name = "api"; }) .WithImagePushOptions(context => @@ -583,7 +583,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api .publishAsDockerComposeService(async (resource, service) => { await service.name.set('api'); @@ -617,7 +617,7 @@ var registry = builder.AddContainerRegistry( ); // Associate resources with the registry -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsDockerComposeService( (resource, service) => { service.Name = "api"; }) .WithContainerRegistry(registry); @@ -637,7 +637,7 @@ const registry = await builder.addContainerRegistry( { repository: 'your-github-username/your-repo' } ); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set('api'); }); @@ -672,7 +672,7 @@ var registry = builder.AddContainerRegistry( registryRepository ); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsDockerComposeService( (resource, service) => { service.Name = "api"; }) .WithContainerRegistry(registry); @@ -700,7 +700,7 @@ const registry = await builder.addContainerRegistry( registryRepository ); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set('api'); }); diff --git a/src/frontend/src/content/docs/deployment/environments.mdx b/src/frontend/src/content/docs/deployment/environments.mdx index 9ed32e74cf..d6ef95148e 100644 --- a/src/frontend/src/content/docs/deployment/environments.mdx +++ b/src/frontend/src/content/docs/deployment/environments.mdx @@ -135,7 +135,7 @@ var dotnetEnvironment = isDevelopment ? "Development" : "Production"; var appEnvironment = isDevelopment ? "development" : "production"; // .NET services use DOTNET_ENVIRONMENT -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment("DOTNET_ENVIRONMENT", dotnetEnvironment); // Node.js services use NODE_ENV @@ -162,7 +162,7 @@ const dotnetEnvironment = isDevelopment ? 'Development' : 'Production'; const appEnvironment = isDevelopment ? 'development' : 'production'; // .NET services use DOTNET_ENVIRONMENT -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withEnvironment('DOTNET_ENVIRONMENT', dotnetEnvironment); // Node.js services use NODE_ENV @@ -216,7 +216,7 @@ var builder = DistributedApplication.CreateBuilder(args); var apiKey = builder.AddParameter("apiKey", secret: true); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment("API_KEY", apiKey); builder.Build().Run(); @@ -232,7 +232,7 @@ const builder = await createBuilder(); const apiKey = await builder.addParameter('apiKey', { secret: true }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withEnvironment('API_KEY', apiKey); await builder.build().run(); @@ -314,7 +314,7 @@ var cache = builder.ExecutionContext.IsRunMode ? builder.AddRedis("cache") : builder.AddAzureManagedRedis("cache"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache); builder.Build().Run(); @@ -333,7 +333,7 @@ const cache = isRunMode ? await builder.addRedis('cache') : await builder.addAzureManagedRedis('cache'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(cache); await builder.build().run(); diff --git a/src/frontend/src/content/docs/deployment/kubernetes-gateway-aks.mdx b/src/frontend/src/content/docs/deployment/kubernetes-gateway-aks.mdx index fbc0945956..17dd96b063 100644 --- a/src/frontend/src/content/docs/deployment/kubernetes-gateway-aks.mdx +++ b/src/frontend/src/content/docs/deployment/kubernetes-gateway-aks.mdx @@ -432,9 +432,9 @@ var k8s = builder.AddKubernetesEnvironment("k8s"); var acr = builder.AddContainerRegistry("acr", registryEndpoint); // Application services -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"); -var frontend = builder.AddProject("frontend") +var frontend = builder.AddDotnetProject("frontend", "../Frontend/Frontend.csproj") .WithReference(api); // Gateway with TLS @@ -474,9 +474,9 @@ const k8s = builder.addKubernetesEnvironment("k8s"); const acr = builder.addContainerRegistry("acr", registryEndpoint); // Application services -const api = builder.addProject("api"); +const api = builder.addDotnetProject("api", "../ApiService/ApiService.csproj"); -const frontend = builder.addProject("frontend") +const frontend = builder.addDotnetProject("frontend", "../Frontend/Frontend.csproj") .withReference(api); // Gateway with TLS diff --git a/src/frontend/src/content/docs/deployment/kubernetes-ingress-aks.mdx b/src/frontend/src/content/docs/deployment/kubernetes-ingress-aks.mdx index 2957d8be70..f4ddf17351 100644 --- a/src/frontend/src/content/docs/deployment/kubernetes-ingress-aks.mdx +++ b/src/frontend/src/content/docs/deployment/kubernetes-ingress-aks.mdx @@ -594,9 +594,9 @@ var k8s = builder.AddKubernetesEnvironment("k8s") var acr = builder.AddContainerRegistry("acr", registryEndpoint); // Application services -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"); -var frontend = builder.AddProject("frontend") +var frontend = builder.AddDotnetProject("frontend", "../Frontend/Frontend.csproj") .WithReference(api); // Ingress @@ -646,9 +646,9 @@ const k8s = builder.addKubernetesEnvironment("k8s") const acr = builder.addContainerRegistry("acr", registryEndpoint); // Application services -const api = builder.addProject("api"); +const api = builder.addDotnetProject("api", "../ApiService/ApiService.csproj"); -const frontend = builder.addProject("frontend") +const frontend = builder.addDotnetProject("frontend", "../Frontend/Frontend.csproj") .withReference(api); // Ingress diff --git a/src/frontend/src/content/docs/deployment/kubernetes-ingress.mdx b/src/frontend/src/content/docs/deployment/kubernetes-ingress.mdx index f09127a462..04197d8307 100644 --- a/src/frontend/src/content/docs/deployment/kubernetes-ingress.mdx +++ b/src/frontend/src/content/docs/deployment/kubernetes-ingress.mdx @@ -74,8 +74,8 @@ Use `WithPath` on an Ingress (or `WithRoute` on a Gateway) to forward traffic fo ```csharp title="AppHost.cs" var k8s = builder.AddKubernetesEnvironment("k8s"); -var api = builder.AddProject("api"); -var web = builder.AddProject("web"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); +var web = builder.AddDotnetProject("web", "../Web/Web.csproj"); var ingress = k8s.AddIngress("public") .WithIngressClass("nginx") @@ -91,8 +91,8 @@ ingress.WithPath("/", web.GetEndpoint("http")); ```typescript title="apphost.mts" const k8s = await builder.addKubernetesEnvironment('k8s'); -const api = await builder.addProject('api'); -const web = await builder.addProject('web'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); +const web = await builder.addDotnetProject('web', '../Web/Web.csproj'); const ingress = await k8s.addIngress('public'); await ingress.withIngressClass('nginx'); diff --git a/src/frontend/src/content/docs/deployment/kubernetes/clusters.mdx b/src/frontend/src/content/docs/deployment/kubernetes/clusters.mdx index 24e26eef43..c585ca8a56 100644 --- a/src/frontend/src/content/docs/deployment/kubernetes/clusters.mdx +++ b/src/frontend/src/content/docs/deployment/kubernetes/clusters.mdx @@ -42,7 +42,7 @@ var builder = DistributedApplication.CreateBuilder(args); var k8s = builder.AddKubernetesEnvironment("k8s"); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); builder.Build().Run(); ``` @@ -79,7 +79,7 @@ var builder = DistributedApplication.CreateBuilder(args); var registry = builder.AddContainerRegistry("registry", "myregistry.example.com:5000"); builder.AddKubernetesEnvironment("k8s").WithContainerRegistry(registry); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); builder.Build().Run(); ``` diff --git a/src/frontend/src/content/docs/deployment/kubernetes/helm-charts.mdx b/src/frontend/src/content/docs/deployment/kubernetes/helm-charts.mdx index 756766fc5b..aa6cafdb07 100644 --- a/src/frontend/src/content/docs/deployment/kubernetes/helm-charts.mdx +++ b/src/frontend/src/content/docs/deployment/kubernetes/helm-charts.mdx @@ -40,7 +40,7 @@ var k8s = builder.AddKubernetesEnvironment("k8s"); k8s.AddHelmChart("cert-manager", "oci://quay.io/jetstack/charts/cert-manager", "1.17.0"); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); builder.Build().Run(); ``` @@ -61,7 +61,7 @@ await k8s.addHelmChart( '1.17.0' ); -const api = await builder.addProject('api', '../MyApi/MyApi.csproj'); +const api = await builder.addDotnetProject('api', '../MyApi/MyApi.csproj'); await builder.build().run(); ``` @@ -216,7 +216,7 @@ aks.AddHelmChart("podinfo", "oci://ghcr.io/stefanprodan/charts/podinfo", "6.7.1" .WithHelmValue("replicaCount", "2") .WithDestroy(); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); builder.Build().Run(); ``` @@ -239,7 +239,7 @@ const podinfo = await aks.addHelmChart( await podinfo.withHelmValue('replicaCount', '2'); await podinfo.withHelmChartDestroy(); -const api = await builder.addProject('api', '../MyApi/MyApi.csproj'); +const api = await builder.addDotnetProject('api', '../MyApi/MyApi.csproj'); await builder.build().run(); ``` @@ -271,7 +271,7 @@ k8s.AddHelmChart("podinfo", "oci://ghcr.io/stefanprodan/charts/podinfo", "6.7.1" .WithHelmValue("replicaCount", "2") .WithDestroy(); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); builder.Build().Run(); ``` @@ -304,7 +304,7 @@ await podinfo.withHelmChartNamespace('podinfo'); await podinfo.withHelmValue('replicaCount', '2'); await podinfo.withHelmChartDestroy(); -const api = await builder.addProject('api', '../MyApi/MyApi.csproj'); +const api = await builder.addDotnetProject('api', '../MyApi/MyApi.csproj'); await builder.build().run(); ``` diff --git a/src/frontend/src/content/docs/deployment/kubernetes/persistent-volumes.mdx b/src/frontend/src/content/docs/deployment/kubernetes/persistent-volumes.mdx index 4624d9c4ff..89a7ca90b2 100644 --- a/src/frontend/src/content/docs/deployment/kubernetes/persistent-volumes.mdx +++ b/src/frontend/src/content/docs/deployment/kubernetes/persistent-volumes.mdx @@ -163,7 +163,7 @@ var media = k8s.AddPersistentVolume("media") .WithCapacity("100Gi") .WithAccessMode(PersistentVolumeAccessMode.ReadWriteMany); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPersistentVolume(media, "/srv/media"); ``` @@ -175,7 +175,7 @@ const media = await k8s.addPersistentVolume('media'); await media.withStorageClass('azurefile-csi'); await media.withCapacity('100Gi'); -const api = await builder.addProject('api'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withKubernetesPersistentVolumeMount(media, '/srv/media'); ``` @@ -193,7 +193,7 @@ Add the `env` parameter to expose the volume's effective storage path through an var data = k8s.AddPersistentVolume("data") .WithCapacity("20Gi"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPersistentVolume(data, "/data", env: "DATA_PATH"); ``` @@ -204,7 +204,7 @@ builder.AddProject("api") const data = await k8s.addPersistentVolume('data'); await data.withCapacity('20Gi'); -const api = await builder.addProject('api'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withKubernetesPersistentVolumeMount(data, '/data', { env: 'DATA_PATH' }); ``` @@ -251,7 +251,7 @@ The default security context is applied before any ("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPersistentVolume(media, "/srv/media") .PublishAsKubernetesService(resource => { @@ -281,7 +281,7 @@ To remove the generated pod security context entirely — for example, when owne ```csharp title="AppHost.cs" using Aspire.Hosting.Kubernetes.Resources; -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPersistentVolume(media, "/srv/media") .PublishAsKubernetesService(resource => { diff --git a/src/frontend/src/content/docs/deployment/pipelines.mdx b/src/frontend/src/content/docs/deployment/pipelines.mdx index f46649be19..b3316a1a3d 100644 --- a/src/frontend/src/content/docs/deployment/pipelines.mdx +++ b/src/frontend/src/content/docs/deployment/pipelines.mdx @@ -291,7 +291,7 @@ await ValidateDatabaseConnection(context); // Define resources var database = builder.AddPostgres("myapp-db"); -var api = builder.AddProject("api").WithReference(database); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(database); ```` @@ -310,7 +310,7 @@ builder.pipeline.addStep("validate-deployment", async (context) => { // Define resources const database = await builder.addPostgres("myapp-db"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(database); async function validateApiHealth(_context: unknown) { @@ -510,7 +510,7 @@ builder.Pipeline.AddStep("validate", async (context) => // Define resources var database = builder.AddPostgres("db"); -var api = builder.AddProject("api").WithReference(database); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(database); builder.Build().Run(); ``` @@ -526,7 +526,7 @@ aspire do validate Resources can contribute their own pipeline steps using : ```csharp title="Resource-level custom step" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPipelineStepFactory(context => { return new PipelineStep() @@ -668,7 +668,7 @@ builder.Pipeline.AddStep("migrate-database", async (context) => dependsOn: ["provision-database"], requiredBy: ["deploy-apiservice"]); -var api = builder.AddProject("api").WithReference(database); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(database); builder.Build().Run(); ``` @@ -748,7 +748,7 @@ Here are some code examples that show Aspire 9.x code and the Aspire 13.x equiva **Before (Aspire 9.x):** ```csharp title="Old publishing callback" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPublishingCallback(async (context, cancellationToken) => { // Custom deployment logic @@ -759,7 +759,7 @@ var api = builder.AddProject("api") **After (Aspire 13.0):** ```csharp title="New pipeline step" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPipelineStepFactory(context => { return new PipelineStep() @@ -810,7 +810,7 @@ dependsOn: [WellKnownPipelineSteps.Deploy]); **Before (Aspire 9.x):** ```csharp title="Old complex callback" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPublishingCallback(async (context, cancellationToken) => { // Multiple deployment steps @@ -838,7 +838,7 @@ builder.Pipeline.AddStep("migrate-database", async (context) => dependsOn: ["provision-infra"], requiredBy: ["deploy-application"]); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithPipelineStepFactory(context => { return new PipelineStep() diff --git a/src/frontend/src/content/docs/extensibility/custom-resources.mdx b/src/frontend/src/content/docs/extensibility/custom-resources.mdx index 6c7a92b793..611e93791c 100644 --- a/src/frontend/src/content/docs/extensibility/custom-resources.mdx +++ b/src/frontend/src/content/docs/extensibility/custom-resources.mdx @@ -250,8 +250,8 @@ Use relationships to organize how resources appear in the dashboard: Create custom relationships between resources for visual organization: ```csharp title="AppHost.cs" -var api = builder.AddProject("api"); -var worker = builder.AddProject("worker") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); +var worker = builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithRelationship(api.Resource, "publishes-to"); ``` @@ -299,7 +299,7 @@ public sealed class MailDevResource(string name) : ContainerResource(name) AppHost authors can override the label for an individual resource with `WithResourceTypeDisplayName`: ```csharp title="C# — AppHost.cs" -builder.AddProject("orders") +builder.AddDotnetProject("orders", "../Orders/Orders.csproj") .WithResourceTypeDisplayName("Orders API"); ``` diff --git a/src/frontend/src/content/docs/extensibility/interaction-service.mdx b/src/frontend/src/content/docs/extensibility/interaction-service.mdx index 69ff759db4..ed70a39fcb 100644 --- a/src/frontend/src/content/docs/extensibility/interaction-service.mdx +++ b/src/frontend/src/content/docs/extensibility/interaction-service.mdx @@ -125,7 +125,7 @@ For example, the following code subscribes to the `ResourceStoppedEvent` on a re var builder = DistributedApplication.CreateBuilder(args); builder - .AddProject("api") + .AddDotnetProject("api", "../Api/Api.csproj") .OnResourceStopped(async (resource, stoppedEvent, cancellationToken) => { if (stoppedEvent.ResourceEvent.Snapshot.ExitCode is not (null or 0)) diff --git a/src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx b/src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx index 0aeb653d2e..7f1a790bae 100644 --- a/src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx +++ b/src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx @@ -867,7 +867,7 @@ await cache.withCommand('clear-cache', 'Clear Cache', async () => { return { success: true }; }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withCommand('reset-all', 'Reset Everything', async (ctx) => { const cancellationToken = await ctx.cancellationToken(); diff --git a/src/frontend/src/content/docs/fundamentals/annotations-overview.mdx b/src/frontend/src/content/docs/fundamentals/annotations-overview.mdx index 6345d86b46..6c3b6771cb 100644 --- a/src/frontend/src/content/docs/fundamentals/annotations-overview.mdx +++ b/src/frontend/src/content/docs/fundamentals/annotations-overview.mdx @@ -84,7 +84,7 @@ Aspire includes many built-in annotation types for common scenarios. This sectio The `EndpointAnnotation` defines network endpoints for resources. It contains information about ports, protocols, and endpoint configuration. ```csharp title="AppHost.cs" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEndpoint(callback: endpoint => { endpoint.Port = 5000; @@ -109,7 +109,7 @@ The `EnvironmentCallbackAnnotation` allows you to modify environment variables a ```csharp title="AppHost.cs" // This is typically used internally by WithReference -var app = builder.AddProject("app") +var app = builder.AddDotnetProject("app", "../MyApp/MyApp.csproj") .WithReference(database); ``` @@ -127,7 +127,7 @@ var postgres = builder.AddPostgres("postgres") The `HealthCheckAnnotation` associates health checks with a resource, used by to determine when a resource is ready: ```csharp title="AppHost.cs" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithHttpHealthCheck("/health"); // Adds HealthCheckAnnotation ``` @@ -143,7 +143,7 @@ The `WaitAnnotation` declares a dependency on another resource and controls star var cache = builder.AddRedis("cache"); // Wait for cache to be healthy before starting web -var web = builder.AddProject("web") +var web = builder.AddDotnetProject("web", "../Web/Web.csproj") .WaitFor(cache); // Adds WaitAnnotation with WaitType.WaitForHealthy ``` @@ -160,7 +160,7 @@ The `WaitType` enum specifies what condition to wait for: The `ReplicaAnnotation` specifies how many instances of a resource should run: ```csharp title="AppHost.cs" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReplicas(3); // Adds ReplicaAnnotation ``` @@ -182,7 +182,7 @@ For details on supported lifetime modes and their use cases, see [Resource lifet The `ExplicitStartupAnnotation` prevents a resource from starting automatically. Users must manually start it from the dashboard: ```csharp title="AppHost.cs" -var worker = builder.AddProject("batch") +var worker = builder.AddDotnetProject("batch", "../BatchJob/BatchJob.csproj") .WithExplicitStart(); // Adds ExplicitStartupAnnotation ``` @@ -259,7 +259,7 @@ Once defined, annotations integrate seamlessly into the AppHost model: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithMetrics("/api/metrics", 9090, "environment:production", "service:api"); ``` diff --git a/src/frontend/src/content/docs/fundamentals/container-networking.mdx b/src/frontend/src/content/docs/fundamentals/container-networking.mdx index 8634e9ecea..6aba3a10b2 100644 --- a/src/frontend/src/content/docs/fundamentals/container-networking.mdx +++ b/src/frontend/src/content/docs/fundamentals/container-networking.mdx @@ -48,7 +48,7 @@ This means that when you write code like the following, the container tunnel ens ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); builder.AddContainer("mycontainer", "myimage") .WithReference(api); @@ -93,7 +93,7 @@ You can use these identifiers when you need to obtain an endpoint for a specific ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); // Resolve the HTTP endpoint for the host network var localhostEndpoint = api.GetEndpoint( diff --git a/src/frontend/src/content/docs/fundamentals/custom-resource-commands.mdx b/src/frontend/src/content/docs/fundamentals/custom-resource-commands.mdx index 68e0211312..ae4daba429 100644 --- a/src/frontend/src/content/docs/fundamentals/custom-resource-commands.mdx +++ b/src/frontend/src/content/docs/fundamentals/custom-resource-commands.mdx @@ -338,9 +338,9 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithClearCommand(); -var apiService = builder.AddProject("apiservice"); +var apiService = builder.AddDotnetProject("apiservice", "../AspireApp.ApiService/AspireApp.ApiService.csproj"); -builder.AddProject("webfrontend") +builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj") .WithExternalHttpEndpoints() .WithReference(cache) .WaitFor(cache) @@ -392,9 +392,9 @@ await cache.withCommand( }, }); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); -const web = await builder.addProject("webfrontend", "../Web/Web.csproj"); +const web = await builder.addDotnetProject("webfrontend", "../Web/Web.csproj"); await web.withExternalHttpEndpoints(); await web.withReference(cache); await web.waitFor(cache); @@ -458,7 +458,7 @@ var database = builder.AddPostgres("postgres") return CommandResults.Success(); }); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache) .WithReference(database) .WithCommand("reset-all", "Reset Everything", async (context, ct) => @@ -513,7 +513,7 @@ await database.withCommand("restart", "Restart Database", async () => { return { success: true }; }); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(cache); await api.withReference(database); await api.withCommand("reset-all", "Reset Everything", async (ctx) => { @@ -709,7 +709,7 @@ using Aspire.Hosting.ApplicationModel; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("myservice") +builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") .WithCommand( name: "issue-access-token", displayName: "Issue Access Token", @@ -735,7 +735,7 @@ using Aspire.Hosting.ApplicationModel; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("myservice") +builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") .WithCommand( name: "issue-access-token", displayName: "Issue Access Token", @@ -843,7 +843,7 @@ using Aspire.Hosting.ApplicationModel; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("myservice") +builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") .WithCommand( name: "migrate-database", displayName: "Migrate Database", @@ -1054,7 +1054,7 @@ using Aspire.Hosting.ApplicationModel; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("myservice") +builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") .WithCommand( name: "send-message", displayName: "Send Message", @@ -1217,7 +1217,7 @@ using Aspire.Hosting.ApplicationModel; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("myservice") +builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") .WithCommand( name: "deploy", displayName: "Deploy", @@ -1320,7 +1320,7 @@ using Aspire.Hosting.ApplicationModel; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("myservice") +builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") // Only exposed through the API/MCP — not shown in the dashboard .WithCommand( name: "get-metrics", @@ -1391,7 +1391,7 @@ Commands can display a progress dialog in the dashboard while they execute. The ```csharp title="AppHost.cs" -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithCommand( name: "seed-database", displayName: "Seed Database", diff --git a/src/frontend/src/content/docs/fundamentals/custom-resource-urls.mdx b/src/frontend/src/content/docs/fundamentals/custom-resource-urls.mdx index 17ef9a5e98..dd357d4bbd 100644 --- a/src/frontend/src/content/docs/fundamentals/custom-resource-urls.mdx +++ b/src/frontend/src/content/docs/fundamentals/custom-resource-urls.mdx @@ -25,8 +25,7 @@ For more information, see [Endpoint extension methods](/fundamentals/networking- Custom resource URLs are supported for the following resource types: - `ContainerResource` -- `ExecutableResource` -- `ProjectResource` +- `ExecutableResource`, including `DotnetProjectResource` ## Customize resource URLs @@ -35,7 +34,7 @@ Use the appropriate ("api"); +var api = builder.AddDotnetProject("api", "../AspireApp.Api/AspireApp.Api.csproj"); api.WithUrl("/admin", "Admin Portal"); @@ -59,7 +58,7 @@ To customize the URL for the first associated resource endpoint, use the `WithUr ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("api") +builder.AddDotnetProject("api", "../AspireApp.Api/AspireApp.Api.csproj") .WithUrlForEndpoint("https", url => { url.DisplayText = "Scalar (HTTPS)"; @@ -82,7 +81,7 @@ When a resource exposes multiple custom URLs, use the `DisplayOrder` property on ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("api") +builder.AddDotnetProject("api", "../AspireApp.Api/AspireApp.Api.csproj") .WithUrlForEndpoint("https", url => { url.DisplayText = "Scalar (HTTPS)"; @@ -100,7 +99,7 @@ To customize multiple URLs for a resource, use the `WithUrls` method. This metho ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("api") +builder.AddDotnetProject("api", "../AspireApp.Api/AspireApp.Api.csproj") .WithUrls(context => { foreach (var url in context.Urls) diff --git a/src/frontend/src/content/docs/fundamentals/environment-variables.mdx b/src/frontend/src/content/docs/fundamentals/environment-variables.mdx index d311465795..0a7ef9a191 100644 --- a/src/frontend/src/content/docs/fundamentals/environment-variables.mdx +++ b/src/frontend/src/content/docs/fundamentals/environment-variables.mdx @@ -31,7 +31,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("my-cache"); var db = builder.AddPostgres("postgres").AddDatabase("my-db"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache) .WithReference(db); @@ -96,7 +96,7 @@ For example: ```csharp title="C# — AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("my-api"); +var api = builder.AddDotnetProject("my-api", "../Api/Api.csproj"); var frontend = builder.AddJavaScriptApp("frontend", "./app") .WithReference(api); @@ -122,7 +122,7 @@ Aspire also generates service discovery variables for .NET service resolution. T services__{resource-name}__{endpoint-key}__{index} ``` -The `services` prefix and double-underscore (`__`) separators are fixed, but the resource name preserves the casing used in the AppHost. For example, `AddProject("MyApi")` with an HTTP endpoint produces `services__MyApi__http__0`. The endpoint key is the scheme for endpoints named `http` or `https`; otherwise, Aspire uses the endpoint name. Applications that don't use .NET service discovery can read the [endpoint URL variables](#endpoint-urls) instead. +The `services` prefix and double-underscore (`__`) separators are fixed, but the resource name preserves the casing used in the AppHost. For example, `AddDotnetProject("MyApi", "../Api/Api.csproj")` with an HTTP endpoint produces `services__MyApi__http__0`. The endpoint key is the scheme for endpoints named `http` or `https`; otherwise, Aspire uses the endpoint name. Applications that don't use .NET service discovery can read the [endpoint URL variables](#endpoint-urls) instead. ### Resource properties diff --git a/src/frontend/src/content/docs/fundamentals/external-parameters.mdx b/src/frontend/src/content/docs/fundamentals/external-parameters.mdx index a3f895f78e..f7802a78db 100644 --- a/src/frontend/src/content/docs/fundamentals/external-parameters.mdx +++ b/src/frontend/src/content/docs/fundamentals/external-parameters.mdx @@ -29,7 +29,7 @@ var builder = DistributedApplication.CreateBuilder(args); // Add a parameter named "example-parameter-name" var parameter = builder.AddParameter("example-parameter-name"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithEnvironment("ENVIRONMENT_VARIABLE_NAME", parameter); ``` @@ -44,7 +44,7 @@ const builder = await createBuilder(); // Add a parameter named "example-parameter-name" const parameter = await builder.addParameter('example-parameter-name'); -const api = await builder.addProject('api', '../ApiService/ApiService.csproj'); +const api = await builder.addDotnetProject('api', '../ApiService/ApiService.csproj'); await api.withEnvironment('ENVIRONMENT_VARIABLE_NAME', parameter); ``` @@ -310,7 +310,7 @@ var builder = DistributedApplication.CreateBuilder(args); // Add a secret parameter named "secret" var secret = builder.AddParameter("secret", secret: true); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithEnvironment("SECRET", secret); builder.Build().Run(); @@ -327,7 +327,7 @@ const builder = await createBuilder(); // Add a secret parameter named "secret" const secret = await builder.addParameter('secret', { secret: true }); -const api = await builder.addProject('api', '../ApiService/ApiService.csproj'); +const api = await builder.addDotnetProject('api', '../ApiService/ApiService.csproj'); await api.withEnvironment('SECRET', secret); await builder.build().run(); @@ -378,7 +378,7 @@ var builder = DistributedApplication.CreateBuilder(args); var messagePrefix = builder.AddParameter("message-prefix") .AsOptional(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithEnvironment("MESSAGE_PREFIX", messagePrefix); builder.Build().Run(); @@ -394,7 +394,7 @@ const builder = await createBuilder(); const messagePrefix = await builder.addParameter('message-prefix').asOptional(); -const api = await builder.addProject('api', '../ApiService/ApiService.csproj'); +const api = await builder.addDotnetProject('api', '../ApiService/ApiService.csproj'); await api.withEnvironment('MESSAGE_PREFIX', messagePrefix); await builder.build().run(); @@ -493,7 +493,7 @@ var dbPassword = builder.AddParameterFromConfiguration( "CustomConfig:Database:Password", secret: true); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithEnvironment("DB_PASSWORD", dbPassword); builder.Build().Run(); @@ -514,7 +514,7 @@ const dbPassword = await builder.addParameterFromConfiguration( { secret: true } ); -const api = await builder.addProject('api', '../ApiService/ApiService.csproj'); +const api = await builder.addDotnetProject('api', '../ApiService/ApiService.csproj'); await api.withEnvironment('DB_PASSWORD', dbPassword); await builder.build().run(); @@ -562,7 +562,7 @@ var builder = DistributedApplication.CreateBuilder(args); var redis = builder.AddConnectionString("redis"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../WebApplication/WebApplication.csproj") .WithReference(redis) .WaitFor(redis); @@ -579,7 +579,7 @@ const builder = await createBuilder(); const redis = await builder.addConnectionString('redis'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'api', '../WebApplication/WebApplication.csproj' ); @@ -624,7 +624,7 @@ var connectionString = builder.AddConnectionString( "composedconnectionstring", ReferenceExpression.Create($"Endpoint=https://api.contoso.com/v1;Key={secretKey}")); -builder.AddProject("catalogapi") +builder.AddDotnetProject("catalogapi", "../AspireReferenceExpressions.CatalogAPI/AspireReferenceExpressions.CatalogAPI.csproj") .WithReference(connectionString) .WaitFor(connectionString); ``` @@ -646,7 +646,7 @@ const connectionString = await builder.addConnectionString( } ); -const catalogApi = await builder.addProject( +const catalogApi = await builder.addDotnetProject( 'catalogapi', '../CatalogApi/CatalogApi.csproj' ); @@ -669,7 +669,7 @@ var pgConnectionString = builder.AddConnectionString( "pgdatabase", ReferenceExpression.Create($"{database};Include Error Details=true")); -builder.AddProject("customerapi") +builder.AddDotnetProject("customerapi", "../AspireReferenceExpressions.CustomerAPI/AspireReferenceExpressions.CustomerAPI.csproj") .WithReference(pgConnectionString) .WaitFor(pgConnectionString); ``` @@ -689,7 +689,7 @@ const pgConnectionString = await builder.addConnectionString('pgdatabase', { environmentVariableNameOrExpression: refExpr`${database};Include Error Details=true`, }); -const customerApi = await builder.addProject( +const customerApi = await builder.addDotnetProject( 'customerapi', '../CustomerApi/CustomerApi.csproj' ); @@ -717,7 +717,7 @@ IResourceBuilder db = builder.ExecutionContext.Is var insertionRows = builder.AddParameter("insertionRows"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Parameters.ApiService/Parameters.ApiService.csproj") .WithEnvironment("InsertionRows", insertionRows) .WithReference(db); @@ -742,7 +742,7 @@ const db = isRunMode const insertionRows = await builder.addParameter('insertionRows'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'api', '../Parameters.ApiService/Parameters.ApiService.csproj' ); diff --git a/src/frontend/src/content/docs/fundamentals/health-checks.mdx b/src/frontend/src/content/docs/fundamentals/health-checks.mdx index 73cc2eb453..857b790016 100644 --- a/src/frontend/src/content/docs/fundamentals/health-checks.mdx +++ b/src/frontend/src/content/docs/fundamentals/health-checks.mdx @@ -441,7 +441,7 @@ var catalogApi = builder.AddContainer("catalog-api", "catalog-api") .WithHttpEndpoint(targetPort: 8080) .WithHttpHealthCheck("/health"); -builder.AddProject("webapp") +builder.AddDotnetProject("webapp", "../WebApp/WebApp.csproj") .WithReference(catalogApi) .WaitFor(catalogApi); // Waits for /health to return HTTP 200 ``` @@ -475,10 +475,10 @@ The ```csharp title="AppHost.cs" -var backend = builder.AddProject("backend") +var backend = builder.AddDotnetProject("backend", "../Backend/Backend.csproj") .WithHttpHealthCheck("/health"); -builder.AddProject("frontend") +builder.AddDotnetProject("frontend", "../Frontend/Frontend.csproj") .WithReference(backend) .WaitFor(backend); ``` @@ -524,7 +524,7 @@ builder.Services.AddHealthChecks().AddCheck("mycheck", () => var pg = builder.AddPostgres("pg") .WithHealthCheck("mycheck"); -builder.AddProject("myapp") +builder.AddDotnetProject("myapp", "../MyApp/MyApp.csproj") .WithReference(pg) .WaitFor(pg); // Waits for both the Postgres container to be running // AND the custom "mycheck" health check to be healthy diff --git a/src/frontend/src/content/docs/fundamentals/http-commands.mdx b/src/frontend/src/content/docs/fundamentals/http-commands.mdx index 46764b77cb..c3457aa04b 100644 --- a/src/frontend/src/content/docs/fundamentals/http-commands.mdx +++ b/src/frontend/src/content/docs/fundamentals/http-commands.mdx @@ -59,7 +59,7 @@ builder.Services.AddHttpClient("commands-with-timeout", client => client.Timeout = TimeSpan.FromSeconds(30); }); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithHttpCommand( path: "/admin/sync", displayName: "Sync now", @@ -84,7 +84,7 @@ var cache = builder.AddRedis("cache"); var apiCacheInvalidationKey = builder.AddParameter("ApiCacheInvalidationKey", secret: true); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../AspireApp.Api/AspireApp.Api.csproj") .WithReference(cache) .WaitFor(cache) .WithEnvironment("ApiCacheInvalidationKey", apiCacheInvalidationKey) @@ -180,7 +180,7 @@ The following example configures an HTTP command that returns a JSON response bo ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithHttpCommand( path: "/admin/sync", displayName: "Sync now", diff --git a/src/frontend/src/content/docs/fundamentals/networking-overview.mdx b/src/frontend/src/content/docs/fundamentals/networking-overview.mdx index 01f998f78d..54e01c4024 100644 --- a/src/frontend/src/content/docs/fundamentals/networking-overview.mdx +++ b/src/frontend/src/content/docs/fundamentals/networking-overview.mdx @@ -504,11 +504,11 @@ var myService = builder.AddContainer("myservice", "myimage") .WithEndpoint("management", ep => ep.ExcludeReferenceEndpoint = true); // Consumer only gets the "api" endpoint — "management" is excluded -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(myService); // Opt in explicitly when the management endpoint is actually needed -var adminApp = builder.AddProject("admin") +var adminApp = builder.AddDotnetProject("admin", "../Admin/Admin.csproj") .WithReference(myService.GetEndpoint("management")); ``` @@ -530,10 +530,10 @@ await myService.withEndpointCallback('management', async (endpoint) => { endpoint.setExcludeReferenceEndpoint(true); }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(myService); -const adminApp = await builder.addProject('admin', '../Admin/Admin.csproj'); +const adminApp = await builder.addDotnetProject('admin', '../Admin/Admin.csproj'); await adminApp.withReference(myService.getEndpoint('management')); ``` @@ -580,7 +580,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withHttpEndpoint({ port: 5000, targetPort: 5000, isProxied: false }); await api.withHttpEndpointCallback( async (endpoint) => { @@ -598,7 +598,7 @@ await builder.build().run(); ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithHttpEndpoint(port: 5000, targetPort: 5000, isProxied: false) .WithEndpoint("http", endpoint => endpoint.TargetHost = "0.0.0.0"); diff --git a/src/frontend/src/content/docs/fundamentals/persist-data-volumes.mdx b/src/frontend/src/content/docs/fundamentals/persist-data-volumes.mdx index 9e97c09692..d36b815074 100644 --- a/src/frontend/src/content/docs/fundamentals/persist-data-volumes.mdx +++ b/src/frontend/src/content/docs/fundamentals/persist-data-volumes.mdx @@ -136,7 +136,7 @@ Volume mount paths often differ between local process execution and deployed con ```csharp title="AppHost.cs" -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithVolume("data", "/data", env: "DATA_PATH"); ``` @@ -144,7 +144,7 @@ builder.AddProject("api") ```typescript title="apphost.mts" -const api = await builder.addProject("api"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withVolume("/data", "data", "DATA_PATH"); ``` diff --git a/src/frontend/src/content/docs/fundamentals/service-discovery.mdx b/src/frontend/src/content/docs/fundamentals/service-discovery.mdx index 79603f78e6..f164164bf0 100644 --- a/src/frontend/src/content/docs/fundamentals/service-discovery.mdx +++ b/src/frontend/src/content/docs/fundamentals/service-discovery.mdx @@ -37,10 +37,10 @@ Configuration for service discovery is only added for services that are referenc ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var catalog = builder.AddProject("catalog"); -var basket = builder.AddProject("basket"); +var catalog = builder.AddDotnetProject("catalog", "../CatalogService/CatalogService.csproj"); +var basket = builder.AddDotnetProject("basket", "../BasketService/BasketService.csproj"); -var frontend = builder.AddProject("frontend") +var frontend = builder.AddDotnetProject("frontend", "../MyFrontend/MyFrontend.csproj") .WithReference(basket) .WithReference(catalog); ``` @@ -53,16 +53,16 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const catalog = await builder.addProject( +const catalog = await builder.addDotnetProject( 'catalog', '../CatalogService/CatalogService.csproj' ); -const basket = await builder.addProject( +const basket = await builder.addDotnetProject( 'basket', '../BasketService/BasketService.csproj' ); -const frontend = await builder.addProject( +const frontend = await builder.addDotnetProject( 'frontend', '../MyFrontend/MyFrontend.csproj' ); @@ -198,7 +198,7 @@ Named endpoints can also be exposed by code in the AppHost. For instance, the pr ```csharp title="AppHost.cs" -var basket = builder.AddProject("basket") +var basket = builder.AddDotnetProject("basket", "../BasketService/BasketService.csproj") .WithHttpsEndpoint(port: 9999, name: "dashboard"); ``` @@ -206,7 +206,7 @@ var basket = builder.AddProject("basket") ```typescript title="apphost.mts" -const basket = await builder.addProject( +const basket = await builder.addDotnetProject( 'basket', '../BasketService/BasketService.csproj' ); @@ -366,7 +366,7 @@ const response = await fetch(`${dashboardUrl}/api/stats`); **Common causes**: 1. **Missing `WithReference()`** - The calling service wasn't connected to the target service in AppHost -2. **Wrong service name** - The name in your URI doesn't match the name in or +2. **Wrong service name** - The name in your URI doesn't match the name in or 3. **Service not started** - The target service failed to start or is still starting **Solution**: Verify your AppHost connects the services: @@ -375,8 +375,8 @@ const response = await fetch(`${dashboardUrl}/api/stats`); ```csharp -var api = builder.AddProject("api"); -var frontend = builder.AddProject("frontend") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); +var frontend = builder.AddDotnetProject("frontend", "../Frontend/Frontend.csproj") .WithReference(api); // This is required! ``` @@ -384,8 +384,8 @@ var frontend = builder.AddProject("frontend") ```typescript title="apphost.mts" -const api = await builder.addProject('api', '../Api/Api.csproj'); -const frontend = await builder.addProject( +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); +const frontend = await builder.addDotnetProject( 'frontend', '../Frontend/Frontend.csproj' ); @@ -405,7 +405,7 @@ await frontend.withReference(api); // This is required! ```csharp -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithHttpEndpoint(port: 9999, name: "dashboard"); // Name must match ``` @@ -413,7 +413,7 @@ var api = builder.AddProject("api") ```typescript title="apphost.mts" -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withHttpEndpoint({ port: 9999, name: 'dashboard' }); // Name must match ``` diff --git a/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx b/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx index 764ff1c145..f2950aea19 100644 --- a/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx +++ b/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx @@ -112,7 +112,7 @@ var builder = DistributedApplication.CreateBuilder(args); var ollama = builder.AddOllama("ollama"); var llama3 = ollama.AddModel("llama3"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(llama3); // After adding all resources, run the app... @@ -192,7 +192,7 @@ var phi35 = ollama.AddModel("phi3.5"); // Add with an explicit resource name var llama3 = ollama.AddModel("ollama-llama3", "llama3"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(phi35) .WithReference(llama3); @@ -277,7 +277,7 @@ var ollama = builder.AddOllama("ollama") var llama3 = ollama.AddModel("llama3"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(llama3); // After adding all resources, run the app... @@ -478,7 +478,7 @@ var llama = ollama.AddHuggingFaceModel( "llama", "bartowski/Llama-3.2-1B-Instruct-GGUF:IQ4_XS"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(llama); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx b/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx index 8fd33b8677..83c2c82a6c 100644 --- a/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx +++ b/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx @@ -106,7 +106,7 @@ var openai = builder.AddOpenAI("openai"); var chat = openai.AddModel("chat", "gpt-4o-mini"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat); // After adding all resources, run the app... @@ -185,7 +185,7 @@ var openai = builder.AddOpenAI("openai"); var chat = openai.AddModel("chat", "gpt-4o-mini"); var embeddings = openai.AddModel("embeddings", "text-embedding-3-small"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WithReference(embeddings); @@ -272,7 +272,7 @@ var openai = builder.AddOpenAI("openai") var chat = openai.AddModel("chat", "gpt-4o-mini"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat); // After adding all resources, run the app... @@ -345,7 +345,7 @@ var openai = builder.AddOpenAI("openai") var chat = openai.AddModel("chat", "gpt-4o-mini"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat); // After adding all resources, run the app... @@ -414,7 +414,7 @@ var openai = builder.AddOpenAI("openai"); var chat = openai.AddModel("chat", "gpt-4o-mini") .WithHealthCheck(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/ai/squad/squad-host.mdx b/src/frontend/src/content/docs/integrations/ai/squad/squad-host.mdx index 520d50e338..b187fd9015 100644 --- a/src/frontend/src/content/docs/integrations/ai/squad/squad-host.mdx +++ b/src/frontend/src/content/docs/integrations/ai/squad/squad-host.mdx @@ -44,7 +44,7 @@ var teamRoot = Path.Combine(builder.AppHostDirectory, "research-squad"); var squad = builder.AddSquad("research-squad", teamRoot); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(squad); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-connect.mdx b/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-connect.mdx index 6b80cb4662..2f6b7f50cc 100644 --- a/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-connect.mdx +++ b/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-connect.mdx @@ -84,7 +84,7 @@ stableDiffusion.AddHuggingFaceModel( "stabilityai/stable-diffusion-xl-base-1.0", "sd_xl_base_1.0.safetensors"); -builder.AddProject("image-api") +builder.AddDotnetProject("image-api", "../ImageApi/ImageApi.csproj") .WithReference(stableDiffusion); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-host.mdx b/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-host.mdx index 3112178e3e..502b0d723b 100644 --- a/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-host.mdx +++ b/src/frontend/src/content/docs/integrations/ai/stable-diffusion-cpp/stable-diffusion-cpp-host.mdx @@ -56,7 +56,7 @@ stableDiffusion.AddHuggingFaceModel( "stabilityai/stable-diffusion-xl-base-1.0", "sd_xl_base_1.0.safetensors"); -builder.AddProject("image-api") +builder.AddDotnetProject("image-api", "../ImageApi/ImageApi.csproj") .WithReference(stableDiffusion); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx b/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx index e5b118a1d1..0f2bca49cd 100644 --- a/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddGarnet("cache"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -170,7 +170,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddGarnet("cache") .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -225,7 +225,7 @@ var cache = builder.AddGarnet("cache") source: "/Garnet/Data", isReadOnly: false); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -285,7 +285,7 @@ var cache = builder.AddGarnet("cache") interval: TimeSpan.FromMinutes(5), keysChangedThreshold: 100); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -347,7 +347,7 @@ var password = builder.AddParameter("password", secret: true); var cache = builder.AddGarnet("cache", port: 6379, password: password); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -475,7 +475,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddConnectionString("cache"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/caching/redis-distributed/redis-distributed-host.mdx b/src/frontend/src/content/docs/integrations/caching/redis-distributed/redis-distributed-host.mdx index 06c6310315..9e56551ad5 100644 --- a/src/frontend/src/content/docs/integrations/caching/redis-distributed/redis-distributed-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/redis-distributed/redis-distributed-host.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/caching/redis-extensions.mdx b/src/frontend/src/content/docs/integrations/caching/redis-extensions.mdx index 0e3de4ddb2..23913c828d 100644 --- a/src/frontend/src/content/docs/integrations/caching/redis-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/caching/redis-extensions.mdx @@ -73,7 +73,7 @@ var builder = DistributedApplication.CreateBuilder(args); var redis = builder.AddRedis("redis") .WithDbGate(); -builder.AddProject("example-project") +builder.AddDotnetProject("example-project", "../ExampleProject/ExampleProject.csproj") .WithReference(redis); builder.Build().Run(); @@ -90,7 +90,7 @@ const builder = await createBuilder(); const redis = await builder.addRedis('redis'); await redis.withDbGate(); -const exampleProject = await builder.addProject( +const exampleProject = await builder.addDotnetProject( 'example-project', '../ExampleProject/ExampleProject.csproj' ); diff --git a/src/frontend/src/content/docs/integrations/caching/redis-output/redis-output-host.mdx b/src/frontend/src/content/docs/integrations/caching/redis-output/redis-output-host.mdx index 38f80546ad..e03afea553 100644 --- a/src/frontend/src/content/docs/integrations/caching/redis-output/redis-output-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/redis-output/redis-output-host.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -119,7 +119,7 @@ const builder = await createBuilder(); const cache = await builder.addRedis("cache"); -await builder.addProject("apiservice", "../ApiService/ApiService.csproj") +await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj") .withReference(cache); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx b/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx index 92ec55fec3..07f11cc117 100644 --- a/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -170,7 +170,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -225,7 +225,7 @@ var cache = builder.AddRedis("cache") source: @"C:\Redis\Data", isReadOnly: false); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -285,7 +285,7 @@ var cache = builder.AddRedis("cache") interval: TimeSpan.FromMinutes(5), keysChangedThreshold: 100); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -345,7 +345,7 @@ var password = builder.AddParameter("password", secret: true); var cache = builder.AddRedis("cache", port: 6379, password: password); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -401,7 +401,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithRedisInsight(); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -456,7 +456,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithRedisInsight(redisInsight => redisInsight.WithHostPort(8001)); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -515,7 +515,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithRedisCommander(); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -570,7 +570,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithRedisCommander(redisCommander => redisCommander.WithHostPort(8081)); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -627,7 +627,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithClearCommand(); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -721,7 +721,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddConnectionString("cache"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx b/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx index 529e7ecffb..1ec7fbe7c2 100644 --- a/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddValkey("cache"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -170,7 +170,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddValkey("cache") .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -225,7 +225,7 @@ var cache = builder.AddValkey("cache") source: "/Valkey/Data", isReadOnly: false); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -285,7 +285,7 @@ var cache = builder.AddValkey("cache") interval: TimeSpan.FromMinutes(5), keysChangedThreshold: 100); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -345,7 +345,7 @@ var password = builder.AddParameter("password", secret: true); var cache = builder.AddValkey("cache", port: 6379, password: password); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -473,7 +473,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddConnectionString("cache"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/aws/overview.mdx b/src/frontend/src/content/docs/integrations/cloud/aws/overview.mdx index b5c5317b26..e60ef93db4 100644 --- a/src/frontend/src/content/docs/integrations/cloud/aws/overview.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/aws/overview.mdx @@ -37,7 +37,7 @@ const builder = await createBuilder(); const dynamodb = await builder.addAWSDynamoDBLocal('dynamodb'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withDynamoDBLocalReference(dynamodb); await builder.build().run(); @@ -51,7 +51,7 @@ var builder = DistributedApplication.CreateBuilder(args); var dynamodb = builder.AddAWSDynamoDBLocal("dynamodb"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(dynamodb); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx index 9aecf717ec..a83ccb7b1f 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx @@ -66,7 +66,7 @@ var foundry = builder.AddFoundry("foundry") var chat = foundry.AddDeployment("chat", FoundryModel.Local.Phi4); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(chat); ``` @@ -127,7 +127,7 @@ var builder = DistributedApplication.CreateBuilder(args); var openai = builder.AddAzureOpenAI("openai"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(openai); ``` @@ -182,7 +182,7 @@ var builder = DistributedApplication.CreateBuilder(args); var openai = builder.AddOpenAI("openai"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(openai); ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx index ff404ffbfe..b66de3e788 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx @@ -126,7 +126,7 @@ var builder = DistributedApplication.CreateBuilder(args); var foundry = builder.AddFoundry("foundry"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(foundry); // After adding all resources, run the app... @@ -143,7 +143,7 @@ const builder = await createBuilder(); const foundry = await builder.addFoundry('foundry'); await builder - .addProject('api', '../ExampleProject/ExampleProject.csproj') + .addDotnetProject('api', '../ExampleProject/ExampleProject.csproj') .withReference(foundry); await builder.build().run(); @@ -200,7 +200,7 @@ var foundry = builder.AddFoundry("foundry"); var chat = foundry.AddDeployment("chat", FoundryModel.OpenAI.Gpt5Mini); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WaitFor(chat); @@ -224,7 +224,7 @@ const chat = await foundry.addDeployment('chat', { }); await builder - .addProject('api', '../ExampleProject/ExampleProject.csproj') + .addDotnetProject('api', '../ExampleProject/ExampleProject.csproj') .withReference(chat) .waitFor(chat); @@ -281,7 +281,7 @@ var foundry = builder.AddFoundry("foundry"); var chat = foundry.AddDeployment("chat", FoundryModel.Microsoft.Phi4Reasoning); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WaitFor(chat); @@ -305,7 +305,7 @@ const chat = await foundry.addDeployment('chat', { }); await builder - .addProject('api', '../ExampleProject/ExampleProject.csproj') + .addDotnetProject('api', '../ExampleProject/ExampleProject.csproj') .withReference(chat) .waitFor(chat); @@ -375,7 +375,7 @@ var project = foundry.AddProject("my-project"); var chat = project.AddModelDeployment("chat", FoundryModel.OpenAI.Gpt5Mini); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(project) .WithReference(chat) .WaitFor(chat); @@ -401,7 +401,7 @@ const chat = await project.addModelDeployment('chat', { }); await builder - .addProject('api', '../ExampleProject/ExampleProject.csproj') + .addDotnetProject('api', '../ExampleProject/ExampleProject.csproj') .withReference(project) .withReference(chat) .waitFor(chat); @@ -544,7 +544,7 @@ await toolbox.withMcpTool('inventory', 'https://inventory.example.com/mcp', { }); await toolbox.withAISearchTool('knowledge-base', search, 'docs'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(toolbox); await api.waitFor(toolbox); @@ -580,7 +580,7 @@ var toolbox = project.AddToolbox("field-tools") }) .WithAISearchTool("knowledge-base", search, "docs"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(toolbox) .WaitFor(toolbox); @@ -684,7 +684,7 @@ builder.AddPythonApp("agent-python", "..\\agent", "main:app") .WithReference(chat) .AsHostedAgent(project); -builder.AddProject("agent-dotnet") +builder.AddDotnetProject("agent-dotnet", "../Agent/Agent.csproj") .WithHttpEndpoint(targetPort: 9000) .WithReference(project) .WithReference(chat) @@ -716,7 +716,7 @@ await builder .asHostedAgent(project); await builder - .addProject('agent-dotnet', '../Agent/Agent.csproj') + .addDotnetProject('agent-dotnet', '../Agent/Agent.csproj') .withHttpEndpoint({ targetPort: 9000 }) .withReference(project) .withReference(chat) @@ -780,7 +780,7 @@ If your hosted agent listens on a different port, declare the endpoint before ca ```csharp -var dotnetWeatherAgent = builder.AddProject("weather-agent-dotnet") +var dotnetWeatherAgent = builder.AddDotnetProject("weather-agent-dotnet", "../WeatherAgent.Dotnet/WeatherAgent.Dotnet.csproj") .WithHttpEndpoint(targetPort: 9000) .WithReference(project).WaitFor(project) .WithReference(chat).WaitFor(chat); @@ -793,7 +793,7 @@ dotnetWeatherAgent.AsHostedAgent(project); ```typescript const dotnetWeatherAgent = await builder - .addProject( + .addDotnetProject( 'weather-agent-dotnet', '../WeatherAgent.Dotnet/WeatherAgent.Dotnet.csproj' ) @@ -1009,7 +1009,7 @@ var existingFoundryResourceGroup = builder.AddParameter("existingFoundryResource var foundry = builder.AddFoundry("foundry") .AsExisting(existingFoundryName, existingFoundryResourceGroup); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(foundry); // After adding all resources, run the app... @@ -1033,7 +1033,7 @@ const foundry = await builder .asExisting(existingFoundryName, existingFoundryResourceGroup); await builder - .addProject('api', '../ExampleProject/ExampleProject.csproj') + .addDotnetProject('api', '../ExampleProject/ExampleProject.csproj') .withReference(foundry); await builder.build().run(); @@ -1096,7 +1096,7 @@ var foundry = builder.AddFoundry("foundry") var chat = foundry.AddDeployment("chat", FoundryModel.Local.Phi4); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WaitFor(chat); @@ -1120,7 +1120,7 @@ const chat = await foundry.addDeployment('chat', { }); await builder - .addProject('api', '../ExampleProject/ExampleProject.csproj') + .addDotnetProject('api', '../ExampleProject/ExampleProject.csproj') .withReference(chat) .waitFor(chat); @@ -1245,7 +1245,7 @@ var builder = DistributedApplication.CreateBuilder(args); var foundry = builder.AddFoundry("chat"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithRoleAssignments(foundry, CognitiveServicesBuiltInRole.CognitiveServicesUser) .WithReference(foundry); @@ -1263,7 +1263,7 @@ const builder = await createBuilder(); const foundry = await builder.addFoundry('chat'); await builder - .addProject('api', '../Api/Api.csproj') + .addDotnetProject('api', '../Api/Api.csproj') .withFoundryRoleAssignments(foundry, [FoundryRole.CognitiveServicesUser]) .withReference(foundry); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-get-started.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-get-started.mdx index 604cf833e1..96dc0b704c 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-get-started.mdx @@ -60,7 +60,7 @@ Getting there is a two-step process: register the connection string in your AppH var aiInference = builder.AddConnectionString("ai-foundry"); - builder.AddProject("myapp") + builder.AddDotnetProject("myapp", "../ExampleProject/ExampleProject.csproj") .WithReference(aiInference); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-host.mdx index 9f5338ce25..8aad503842 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-inference/azure-ai-inference-host.mdx @@ -35,7 +35,7 @@ var builder = DistributedApplication.CreateBuilder(args); var aiInference = builder.AddConnectionString("ai-foundry"); -builder.AddProject("myapp") +builder.AddDotnetProject("myapp", "../ExampleProject/ExampleProject.csproj") .WithReference(aiInference); // After adding all resources, run the app... @@ -52,7 +52,7 @@ const builder = await createBuilder(); const aiInference = await builder.addConnectionString("ai-foundry"); -const myapp = await builder.addProject("myapp", "../ExampleProject/ExampleProject.csproj"); +const myapp = await builder.addDotnetProject("myapp", "../ExampleProject/ExampleProject.csproj"); await myapp.withReference(aiInference); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-search/azure-ai-search-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-search/azure-ai-search-host.mdx index 8fd662d956..db407e45f9 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-search/azure-ai-search-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-search/azure-ai-search-host.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var search = builder.AddAzureSearch("search"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(search); // After adding all resources, run the app... @@ -118,7 +118,7 @@ const builder = await createBuilder(); const search = await builder.addAzureSearch("search"); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(search); // After adding all resources, run the app... @@ -178,7 +178,7 @@ var existingSearchResourceGroup = builder.AddParameter("existingSearchResourceGr var search = builder.AddAzureSearch("search") .AsExisting(existingSearchName, existingSearchResourceGroup); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(search); // After adding all resources, run the app... @@ -196,7 +196,7 @@ const existingSearchName = await builder.addParameter("existingSearchName"); const search = await builder.addAzureSearch("search"); await search.asExisting(existingSearchName); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(search); // After adding all resources, run the app... @@ -390,7 +390,7 @@ var builder = DistributedApplication.CreateBuilder(args); var search = builder.AddAzureSearch("search"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(search) .WithRoleAssignments(search, AzureSearchRole.SearchIndexDataReader); ``` @@ -407,7 +407,7 @@ const builder = await createBuilder(); const search = await builder.addAzureSearch("search"); -const api = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +const api = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(search); // Assign only the data-reader role to the api project diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-get-started.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-get-started.mdx index 2e9e74f2b0..39e0db32ad 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-get-started.mdx @@ -76,7 +76,7 @@ const builder = await createBuilder(); const environment = await builder.addAzureContainerAppEnvironment("env"); -const catalog = await builder.addProject("catalog", "../Catalog/Catalog.csproj") +const catalog = await builder.addDotnetProject("catalog", "../Catalog/Catalog.csproj") .withComputeEnvironment(environment) .withExternalHttpEndpoints(); @@ -100,7 +100,7 @@ var builder = DistributedApplication.CreateBuilder(args); var environment = builder.AddAzureContainerAppEnvironment("env"); -var catalog = builder.AddProject("catalog") +var catalog = builder.AddDotnetProject("catalog", "../Catalog/Catalog.csproj") .WithComputeEnvironment(environment) .WithExternalHttpEndpoints(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-networking.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-networking.mdx index 012afe3787..43c52179a1 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-networking.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-api-management/azure-api-management-networking.mdx @@ -220,7 +220,7 @@ const environment = await builder.addAzureContainerAppEnvironment("env"); await environment.withDelegatedSubnet(containerAppsSubnet); await environment.withInternalLoadBalancer(vnet); -const catalog = await builder.addProject("catalog", "../Catalog/Catalog.csproj") +const catalog = await builder.addDotnetProject("catalog", "../Catalog/Catalog.csproj") .withComputeEnvironment(environment) .withExternalHttpEndpoints(); @@ -256,7 +256,7 @@ var environment = builder.AddAzureContainerAppEnvironment("env") .WithDelegatedSubnet(containerAppsSubnet) .WithInternalLoadBalancer(vnet); -var catalog = builder.AddProject("catalog") +var catalog = builder.AddDotnetProject("catalog", "../Catalog/Catalog.csproj") .WithComputeEnvironment(environment) .WithExternalHttpEndpoints(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx index d4f278d2bd..85b5c36214 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx @@ -1,4 +1,4 @@ ---- +--- title: Set up Azure App Configuration in the AppHost description: Learn how to use the Aspire Azure App Configuration Hosting integration to orchestrate and configure an App Configuration store in an Aspire solution. --- @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var appConfig = builder.AddAzureAppConfiguration("config"); -builder.AddProject("web") +builder.AddDotnetProject("web", "../WebApplication/WebApplication.csproj") .WithReference(appConfig); // After adding all resources, run the app... @@ -123,7 +123,7 @@ const builder = await createBuilder(); const appConfig = await builder.addAzureAppConfiguration("config"); -await builder.addProject("web", "../WebApplication/WebApplication.csproj") +await builder.addDotnetProject("web", "../WebApplication/WebApplication.csproj") .withReference(appConfig); // After adding all resources, run the app... @@ -670,7 +670,7 @@ var builder = DistributedApplication.CreateBuilder(args); var config = builder.AddConnectionString("config"); -builder.AddProject("web") +builder.AddDotnetProject("web", "../WebApplication/WebApplication.csproj") .WithReference(config); // After adding all resources, run the app... @@ -688,7 +688,7 @@ const builder = await createBuilder(); const config = await builder.addConnectionString("config"); -await builder.addProject("web", "../WebApplication/WebApplication.csproj") +await builder.addDotnetProject("web", "../WebApplication/WebApplication.csproj") .withReference(config); // After adding all resources, run the app... @@ -749,7 +749,7 @@ var builder = DistributedApplication.CreateBuilder(args); var appConfig = builder.AddAzureAppConfiguration("config"); -builder.AddProject("web") +builder.AddDotnetProject("web", "../WebApplication/WebApplication.csproj") .WithReference(appConfig) .WithRoleAssignments(appConfig, AzureAppConfigurationRole.AppConfigurationDataReader); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx index d968314316..a1f38f63fa 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx @@ -116,7 +116,7 @@ var builder = DistributedApplication.CreateBuilder(args); var appServiceEnv = builder.AddAzureAppServiceEnvironment("app-service-env"); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../WebApi/WebApi.csproj"); // After adding all resources, run the app... builder.Build().Run(); @@ -133,7 +133,7 @@ const builder = await createBuilder(); const appServiceEnv = await builder.addAzureAppServiceEnvironment('app-service-env'); -await builder.addProject('api', '../WebApi/WebApi.csproj'); +await builder.addDotnetProject('api', '../WebApi/WebApi.csproj'); await builder.build().run(); ``` @@ -213,7 +213,7 @@ var existingResourceGroup = builder.AddParameter("existingResourceGroup"); var appServiceEnv = builder.AddAzureAppServiceEnvironment("app-service-env") .AsExisting(existingAppServicePlanName, existingResourceGroup); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../WebApi/WebApi.csproj"); // After adding all resources, run the app... builder.Build().Run(); @@ -241,7 +241,7 @@ await appServiceEnv.asExisting( existingResourceGroup ); -await builder.addProject('api', '../WebApi/WebApi.csproj'); +await builder.addDotnetProject('api', '../WebApi/WebApi.csproj'); await builder.build().run(); ``` @@ -290,7 +290,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureAppServiceEnvironment("app-service-env"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../WebApi/WebApi.csproj") .PublishAsAzureAppServiceWebsite((infra, website) => { website.AppSettings.Add("ASPNETCORE_ENVIRONMENT", new AppServiceConfigurationSetting @@ -316,7 +316,7 @@ const builder = await createBuilder(); await builder.addAzureAppServiceEnvironment('app-service-env'); -const api = await builder.addProject('api', '../WebApi/WebApi.csproj'); +const api = await builder.addDotnetProject('api', '../WebApi/WebApi.csproj'); await api.publishAsAzureAppServiceWebsite({ configure: async (infra, website) => { // Customize infrastructure here using Azure Provisioning APIs @@ -384,11 +384,11 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureAppServiceEnvironment("appservice") .WithDeploymentSlot("staging"); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithHttpHealthCheck("/health") .WithExternalHttpEndpoints(); -builder.AddProject("webfrontend") +builder.AddDotnetProject("webfrontend", "../Web/Web.csproj") .WithExternalHttpEndpoints() .WithHttpHealthCheck("/health") .WithReference(apiService) @@ -409,13 +409,13 @@ await ( await builder.addAzureAppServiceEnvironment('appservice') ).withDeploymentSlot('staging'); -const apiService = await builder.addProject( +const apiService = await builder.addDotnetProject( 'apiservice', '../ApiService/ApiService.csproj' ); await builder - .addProject('webfrontend', '../Web/Web.csproj') + .addDotnetProject('webfrontend', '../Web/Web.csproj') .withReference(apiService) .waitFor(apiService); @@ -548,7 +548,7 @@ When you customize App Service resources using `PublishAsAzureAppServiceWebsite` ```csharp title="AppHost.cs" -builder.AddProject("api") +builder.AddDotnetProject("api", "../WebApi/WebApi.csproj") .PublishAsAzureAppServiceWebsite((infra, website) => { website.Tags.Add("Slot", "production"); @@ -559,7 +559,7 @@ builder.AddProject("api") ```typescript title="apphost.mts" -const api = await builder.addProject('api', '../WebApi/WebApi.csproj'); +const api = await builder.addDotnetProject('api', '../WebApi/WebApi.csproj'); await api.publishAsAzureAppServiceWebsite({ configure: async (infra, website) => { // Production website customizations @@ -606,7 +606,7 @@ var appServiceEnv = builder.AddAzureAppServiceEnvironment("app-service-env") #pragma warning restore ASPIREAZURE003 -builder.AddProject("api"); +builder.AddDotnetProject("api", "../WebApi/WebApi.csproj"); builder.Build().Run(); ``` @@ -626,7 +626,7 @@ const appServiceEnv = await builder .addAzureAppServiceEnvironment('app-service-env') .withDelegatedSubnet(subnet); -await builder.addProject('api', '../WebApi/WebApi.csproj'); +await builder.addDotnetProject('api', '../WebApi/WebApi.csproj'); await builder.build().run(); ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-application-insights.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-application-insights.mdx index 84ccd4829d..2704a03010 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-application-insights.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-application-insights.mdx @@ -109,7 +109,7 @@ var builder = DistributedApplication.CreateBuilder(args); var appInsights = builder.AddAzureApplicationInsights("app-insights"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(appInsights); // After adding all resources, run the app... @@ -185,7 +185,7 @@ var builder = DistributedApplication.CreateBuilder(args); var logAnalytics = builder.AddAzureLogAnalyticsWorkspace("log-analytics"); var appInsights = builder.AddAzureApplicationInsights("app-insights", logAnalytics); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(appInsights); // After adding all resources, run the app... @@ -253,7 +253,7 @@ var logAnalytics = builder.AddAzureLogAnalyticsWorkspace("log-analytics"); var appInsights = builder.AddAzureApplicationInsights("app-insights") .WithLogAnalyticsWorkspace(logAnalytics); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(appInsights); // After adding all resources, run the app... @@ -368,7 +368,7 @@ var appInsights = builder.AddAzureApplicationInsights("app-insights") insights.Tags.Add("environment", "production"); }); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(appInsights); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx index 2d7d47d30b..e94febc4d1 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddAzureManagedRedis("cache"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -181,7 +181,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddAzureManagedRedis("cache") .RunAsContainer(); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -250,7 +250,7 @@ var existingRedisResourceGroup = builder.AddParameter("existingRedisResourceGrou var cache = builder.AddAzureManagedRedis("cache") .AsExisting(existingRedisName, existingRedisResourceGroup); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... @@ -318,7 +318,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddAzureManagedRedis("cache") .WithAccessKeyAuthentication(); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cache); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-connector-namespace.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-connector-namespace.mdx index f29360701c..4b0ac8a4db 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-connector-namespace.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-connector-namespace.mdx @@ -45,7 +45,7 @@ await outlook.withAccessPolicy('worker-access', { tenantId: '22222222-2222-2222-2222-222222222222', }); -const worker = await builder.addProject('worker', '../Worker/Worker.csproj'); +const worker = await builder.addDotnetProject('worker', '../Worker/Worker.csproj'); await worker.withReference(outlook); const mcp = await connectors.addMcpServerConfig('outlook-mcp'); @@ -83,7 +83,7 @@ var outlook = connectors.AddConnection( TenantId = "22222222-2222-2222-2222-222222222222" }); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(outlook); connectors.AddMcpServerConfig("outlook-mcp") diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx index 1806b8b1a8..2c609c411c 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx @@ -340,7 +340,7 @@ var builder = DistributedApplication.CreateBuilder(args); var acr = builder.AddAzureContainerRegistry("my-acr"); // Grant the 'api' project permission to push images -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithRoleAssignments(acr, ContainerRegistryBuiltInRole.AcrPush); builder.Build().Run(); @@ -357,7 +357,7 @@ const builder = await createBuilder(); const acr = await builder.addAzureContainerRegistry("my-acr"); // Grant the 'api' project permission to push images -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withRoleAssignments(acr, [AzureContainerRegistryRole.AcrPush]); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx index fba56e7b71..41b84ed656 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx @@ -107,7 +107,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cosmos = builder.AddAzureCosmosDB("cosmos-db"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(cosmos); // After adding all resources, run the app... @@ -515,7 +515,7 @@ var existingCosmosResourceGroup = builder.AddParameter("existingCosmosResourceGr var cosmos = builder.AddAzureCosmosDB("cosmos-db") .AsExisting(existingCosmosName, existingCosmosResourceGroup); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cosmos); // After adding all resources, run the app... @@ -679,7 +679,7 @@ var orders = cosmos.AddCosmosDatabase("orders"); var details = orders.AddContainer("details", "/id"); var history = orders.AddContainer("history", "/id"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(profiles) .WithReference(details) .WithReference(history); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx index 6cd153349d..bea898fb53 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx @@ -109,7 +109,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kusto = builder.AddAzureKustoCluster("kusto"); var database = kusto.AddReadWriteDatabase("analytics"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(database) .WaitFor(database); @@ -174,7 +174,7 @@ var kusto = builder.AddAzureKustoCluster("kusto") var database = kusto.AddReadWriteDatabase("analytics"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(database) .WaitFor(database); @@ -296,7 +296,7 @@ var database = kusto.AddReadWriteDatabase("analytics") ) """); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(database) .WaitFor(database); @@ -321,7 +321,7 @@ const database = await kusto.addReadWriteDatabase("analytics") ) `); -const exampleProject = await builder.addProject("example", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("example", "../ExampleProject/ExampleProject.csproj"); await exampleProject .withReference(database) .waitFor(database); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx index 983a2fa5f4..fb79b7ea05 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx @@ -112,7 +112,7 @@ var builder = DistributedApplication.CreateBuilder(args); var eventHubs = builder.AddAzureEventHubs("event-hubs"); eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -180,7 +180,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs"); var messages = eventHubs.AddHub("messages"); messages.AddConsumerGroup("messagesConsumer"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -237,7 +237,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs") eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -307,7 +307,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs") eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -377,7 +377,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs") eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -408,7 +408,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs") eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -441,7 +441,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs") eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -515,7 +515,7 @@ var eventHubs = builder.AddAzureEventHubs("event-hubs") eventHubs.AddHub("messages"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -540,7 +540,7 @@ var existingResourceGroup = builder.AddParameter("existingEventHubsResourceGroup var eventHubs = builder.AddAzureEventHubs("event-hubs") .AsExisting(existingName, existingResourceGroup); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(eventHubs); // After adding all resources, run the app... @@ -605,7 +605,7 @@ var builder = DistributedApplication.CreateBuilder(args); var eventHubs = builder.AddAzureEventHubs("event-hubs"); -builder.AddProject() +builder.AddDotnetProject("exampleservice", "../ExampleService/ExampleService.csproj") .WithReference(eventHubs) .WithRoleAssignments(eventHubs, AzureEventHubsRole.AzureEventHubsDataSender); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-front-door.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-front-door.mdx index bc2b507549..eae30951d9 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-front-door.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-front-door.mdx @@ -43,7 +43,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureAppServiceEnvironment("production"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints(); builder.AddAzureFrontDoor("frontdoor") @@ -63,7 +63,7 @@ const builder = await createBuilder(); await builder.addAzureAppServiceEnvironment("production"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withExternalHttpEndpoints(); const frontdoor = await builder.addAzureFrontDoor("frontdoor"); @@ -141,10 +141,10 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureAppServiceEnvironment("production"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints(); -var web = builder.AddProject("web") +var web = builder.AddDotnetProject("web", "../Web/Web.csproj") .WithExternalHttpEndpoints(); builder.AddAzureFrontDoor("frontdoor") @@ -164,10 +164,10 @@ const builder = await createBuilder(); await builder.addAzureAppServiceEnvironment("production"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withExternalHttpEndpoints(); -const web = await builder.addProject("web", "../Web/Web.csproj"); +const web = await builder.addDotnetProject("web", "../Web/Web.csproj"); await web.withExternalHttpEndpoints(); const frontdoor = await builder.addAzureFrontDoor("frontdoor"); @@ -351,7 +351,7 @@ const builder = await createBuilder(); await builder.addAzureAppServiceEnvironment("production"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withExternalHttpEndpoints(); const frontdoor = await builder.addAzureFrontDoor("frontdoor"); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-functions/azure-functions-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-functions/azure-functions-host.mdx index c1b56278c3..78cb59d763 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-functions/azure-functions-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-functions/azure-functions-host.mdx @@ -130,7 +130,7 @@ var builder = DistributedApplication.CreateBuilder(args); var functions = builder.AddAzureFunctionsProject("functions") .WithExternalHttpEndpoints(); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(functions) .WaitFor(functions); @@ -151,7 +151,7 @@ var builder = DistributedApplication.CreateBuilder(args); var functions = builder.AddAzureFunctionsProject("functions", "../MyFunctions/MyFunctions.csproj") .WithExternalHttpEndpoints(); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(functions) .WaitFor(functions); @@ -232,7 +232,7 @@ var storage = builder.AddAzureStorage("storage") var functions = builder.AddAzureFunctionsProject("functions") .WithHostStorage(storage); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(functions) .WaitFor(functions); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx index 1ae6f602f1..0a84524bd7 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx @@ -104,7 +104,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keyVault = builder.AddAzureKeyVault("key-vault"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(keyVault); // After adding all resources, run the app... @@ -121,7 +121,7 @@ const builder = await createBuilder(); const keyVault = await builder.addAzureKeyVault("key-vault"); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(keyVault); await builder.build().run(); @@ -186,7 +186,7 @@ var existingKeyVaultResourceGroup = builder.AddParameter("existingKeyVaultResour var keyVault = builder.AddAzureKeyVault("key-vault") .AsExisting(existingKeyVaultName, existingKeyVaultResourceGroup); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(keyVault); // After adding all resources, run the app... @@ -206,7 +206,7 @@ const existingKeyVaultName = await builder.addParameter("existingKeyVaultName"); const keyVault = await builder.addAzureKeyVault("key-vault"); await keyVault.asExisting(existingKeyVaultName); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(keyVault); await builder.build().run(); @@ -264,7 +264,7 @@ By default, `AddAzureKeyVault` configures a [Key Vault Administrator built-in ro var builder = DistributedApplication.CreateBuilder(args); var keyVault = builder.AddAzureKeyVault("key-vault") - .WithRoleAssignments(builder.AddProject("apiservice"), + .WithRoleAssignments(builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"), KeyVaultBuiltInRole.KeyVaultSecretsUser); // After adding all resources, run the app... @@ -281,7 +281,7 @@ const builder = await createBuilder(); const keyVault = await builder.addAzureKeyVault("key-vault"); -const api = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const api = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await api.withRoleAssignments(keyVault, [AzureKeyVaultRole.KeyVaultSecretsUser]); await builder.build().run(); @@ -398,7 +398,7 @@ var existingKeyVaultResourceGroup = builder.AddParameter("existingKeyVaultResour var keyVault = builder.AddAzureKeyVault("key-vault") .AsExisting(existingKeyVaultName, existingKeyVaultResourceGroup); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(keyVault) .WithEnvironment("API_KEY", keyVault.GetSecret("my-api-key")); @@ -421,7 +421,7 @@ await keyVault.asExisting(existingKeyVaultName); const secretRef = await keyVault.getSecret("my-api-key"); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(keyVault) .withEnvironment("API_KEY", secretRef); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-log-analytics.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-log-analytics.mdx index 886924bf62..6b8b065412 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-log-analytics.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-log-analytics.mdx @@ -185,7 +185,7 @@ var builder = DistributedApplication.CreateBuilder(args); var logAnalytics = builder.AddAzureLogAnalyticsWorkspace("log-analytics"); var appInsights = builder.AddAzureApplicationInsights("app-insights", logAnalytics); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(appInsights); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx index 2b14822b3e..7ac81f17e5 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx @@ -108,7 +108,7 @@ var chat = openai.AddDeployment( modelName: "gpt-4o", modelVersion: "2024-08-06"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WaitFor(chat); @@ -188,7 +188,7 @@ var openai = builder.AddAzureOpenAI("openai"); var chat = openai.AddDeployment("chat", "gpt-4o", "2024-08-06"); var embeddings = openai.AddDeployment("embeddings", "text-embedding-3-small", "1"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WithReference(embeddings) .WaitFor(chat) @@ -259,7 +259,7 @@ var openai = builder.AddAzureOpenAI("openai"); var chat = openai.AddDeployment("chat", "gpt-4o", "2024-08-06"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WaitFor(chat) .WithRoleAssignments(openai, AzureOpenAIRole.CognitiveServicesOpenAIContributor); @@ -366,7 +366,7 @@ var openai = builder.AddAzureOpenAI("openai") var chat = openai.AddDeployment("chat", "gpt-4o", "2024-08-06"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(chat) .WaitFor(chat); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx index 698865c543..c0e830d4dd 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx @@ -107,7 +107,7 @@ var builder = DistributedApplication.CreateBuilder(args); var postgres = builder.AddAzurePostgresFlexibleServer("postgres"); var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WaitFor(postgresdb) .WithReference(postgresdb); @@ -187,11 +187,11 @@ var postgres = builder.AddAzurePostgresFlexibleServer("postgres"); var catalogDb = postgres.AddDatabase("catalogdb"); var ordersDb = postgres.AddDatabase("ordersdb"); -builder.AddProject("catalog") +builder.AddDotnetProject("catalog", "../CatalogService/CatalogService.csproj") .WithReference(catalogDb) .WaitFor(catalogDb); -builder.AddProject("orders") +builder.AddDotnetProject("orders", "../OrdersService/OrdersService.csproj") .WithReference(ordersDb) .WaitFor(ordersDb); @@ -281,7 +281,7 @@ var postgres = builder.AddAzurePostgresFlexibleServer("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb) .WaitFor(postgresdb); @@ -365,7 +365,7 @@ var existingPostgresResourceGroup = builder.AddParameter("existingPostgresResour var postgres = builder.AddAzurePostgresFlexibleServer("postgres") .AsExisting(existingPostgresName, existingPostgresResourceGroup); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(postgres); // After adding all resources, run the app... @@ -435,7 +435,7 @@ var postgres = builder.AddAzurePostgresFlexibleServer("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb) .WaitFor(postgresdb); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx index 4cdd37c66e..f24ea0eb81 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx @@ -185,7 +185,7 @@ var existingServiceBusResourceGroup = builder.AddParameter("existingServiceBusRe var serviceBus = builder.AddAzureServiceBus("messaging") .AsExisting(existingServiceBusName, existingServiceBusResourceGroup); -builder.AddProject("web") +builder.AddDotnetProject("web", "../WebApplication/WebApplication.csproj") .WithReference(serviceBus); // After adding all resources, run the app... @@ -265,7 +265,7 @@ var builder = DistributedApplication.CreateBuilder(args); var serviceBus = builder.AddAzureServiceBus("messaging"); var queue = serviceBus.AddServiceBusQueue("queue"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(queue); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-signalr/azure-signalr-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-signalr/azure-signalr-host.mdx index 34e17373d1..89e1422ab1 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-signalr/azure-signalr-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-signalr/azure-signalr-host.mdx @@ -104,7 +104,7 @@ var builder = DistributedApplication.CreateBuilder(args); var signalR = builder.AddAzureSignalR("signalr"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithReference(signalR) .WaitFor(signalR); @@ -120,7 +120,7 @@ const builder = await createBuilder(); const signalR = await builder.addAzureSignalR("signalr"); -await builder.addProject("api", "../ApiService/ApiService.csproj") +await builder.addDotnetProject("api", "../ApiService/ApiService.csproj") .withReference(signalR) .waitFor(signalR); @@ -193,7 +193,7 @@ var signalR = builder.AddAzureSignalR( "signalr", AzureSignalRServiceMode.Serverless); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithReference(signalR) .WaitFor(signalR); @@ -280,7 +280,7 @@ var builder = DistributedApplication.CreateBuilder(args); var signalR = builder.AddAzureSignalR("signalr", AzureSignalRServiceMode.Serverless) .RunAsEmulator(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithReference(signalR) .WaitFor(signalR); @@ -297,7 +297,7 @@ const builder = await createBuilder(); const signalR = await builder.addAzureSignalR("signalr") .runAsEmulator(); -await builder.addProject("api", "../ApiService/ApiService.csproj") +await builder.addDotnetProject("api", "../ApiService/ApiService.csproj") .withReference(signalR) .waitFor(signalR); @@ -350,7 +350,7 @@ var existingSignalRResourceGroup = builder.AddParameter("existingSignalRResource var signalR = builder.AddAzureSignalR("signalr") .AsExisting(existingSignalRName, existingSignalRResourceGroup); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithReference(signalR); // After adding all resources, run the app... @@ -369,7 +369,7 @@ const existingRG = await builder.addParameter("existingSignalRResourceGroup"); const signalR = await builder.addAzureSignalR("signalr") .asExisting(existingName, { resourceGroup: existingRG }); -await builder.addProject("api", "../ApiService/ApiService.csproj") +await builder.addDotnetProject("api", "../ApiService/ApiService.csproj") .withReference(signalR); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-sql-database/azure-sql-database-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-sql-database/azure-sql-database-host.mdx index a4188c4bfa..a5dfbe61a4 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-sql-database/azure-sql-database-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-sql-database/azure-sql-database-host.mdx @@ -106,7 +106,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sql = builder.AddAzureSqlServer("sql"); var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(db); // After adding all resources, run the app... @@ -198,7 +198,7 @@ var sql = builder.AddAzureSqlServer("sql") var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(db); // After adding all resources, run the app... @@ -280,7 +280,7 @@ var sql = builder.AddAzureSqlServer("sql") .AsExisting(existingName, existingResourceGroup) .AddDatabase("database"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(sql); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx index 5f73bf52d5..de434dcef6 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx @@ -163,7 +163,7 @@ var builder = DistributedApplication.CreateBuilder(args); var blobs = builder.AddAzureStorage("storage") .AddBlobs("blobs"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(blobs) .WaitFor(blobs); @@ -180,7 +180,7 @@ const builder = await createBuilder(); const blobs = await builder.addAzureStorage("storage") .addBlobs("blobs"); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(blobs) .waitFor(blobs); @@ -232,7 +232,7 @@ var builder = DistributedApplication.CreateBuilder(args); var container = builder.AddAzureStorage("storage") .AddBlobContainer("uploads", blobContainerName: "upload-data"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(container) .WaitFor(container); @@ -249,7 +249,7 @@ const builder = await createBuilder(); const container = await builder.addAzureStorage("storage") .addBlobContainer("uploads", { blobContainerName: "upload-data" }); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(container) .waitFor(container); @@ -298,7 +298,7 @@ var blobs = builder.AddAzureStorage("storage") .RunAsEmulator() .AddBlobs("blobs"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(blobs) .WaitFor(blobs); @@ -316,7 +316,7 @@ const blobs = await builder.addAzureStorage("storage") .runAsEmulator() .addBlobs("blobs"); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(blobs) .waitFor(blobs); @@ -631,7 +631,7 @@ var blobs = builder.AddAzureStorage("storage") .AsExisting(existingStorageName, existingStorageResourceGroup) .AddBlobs("blobs"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(blobs); // After adding all resources, run the app... @@ -651,7 +651,7 @@ const blobs = await builder.addAzureStorage("storage") .asExisting(existingStorageName, { resourceGroup: existingStorageResourceGroup }) .addBlobs("blobs"); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(blobs); // After adding all resources, run the app... @@ -731,7 +731,7 @@ var builder = DistributedApplication.CreateBuilder(args); var storage = builder.AddAzureStorage("storage"); var blobs = storage.AddBlobs("blobs"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(blobs) .WithRoleAssignments(storage, AzureStorageRole.StorageBlobDataReader); @@ -748,7 +748,7 @@ const builder = await createBuilder(); const storage = await builder.addAzureStorage("storage"); const blobs = await storage.addBlobs("blobs"); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(blobs) .withRoleAssignments(storage, [AzureStorageRole.StorageBlobDataReader]); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx index 1515cd6457..ef2442d325 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var storage = builder.AddAzureStorage("storage"); var dataLake = storage.AddDataLake("datalake"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(dataLake) .WaitFor(dataLake); @@ -120,7 +120,7 @@ const builder = await createBuilder(); const storage = await builder.addAzureStorage("storage"); const dataLake = await storage.addDataLake("datalake"); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(dataLake) .waitFor(dataLake); @@ -187,7 +187,7 @@ var storage = builder.AddAzureStorage("storage"); var dataLake = storage.AddDataLake("datalake"); var fileSystem = storage.AddDataLakeFileSystem("analytics", "analytics-data"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(dataLake) .WithReference(fileSystem) .WaitFor(dataLake); @@ -206,7 +206,7 @@ const storage = await builder.addAzureStorage("storage"); const dataLake = await storage.addDataLake("datalake"); const fileSystem = await storage.addDataLakeFileSystem("analytics", { dataLakeFileSystemName: "analytics-data" }); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(dataLake) .withReference(fileSystem) .waitFor(dataLake); @@ -284,7 +284,7 @@ var storage = builder.AddAzureStorage("storage") var dataLake = storage.AddDataLake("datalake"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(dataLake); // After adding all resources, run the app... @@ -308,7 +308,7 @@ const storage = await builder.addAzureStorage("storage") const dataLake = await storage.addDataLake("datalake"); -await builder.addProject("api", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .withReference(dataLake); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx index 452f0b5ffe..8daeaafa0d 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx @@ -108,7 +108,7 @@ var builder = DistributedApplication.CreateBuilder(args); var queues = builder.AddAzureStorage("storage") .AddQueues("queues"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(queues) .WaitFor(queues); @@ -188,7 +188,7 @@ var queues = builder.AddAzureStorage("storage") .RunAsEmulator() .AddQueues("queues"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(queues) .WaitFor(queues); @@ -561,7 +561,7 @@ var queues = builder.AddAzureStorage("storage") .AsExisting(existingStorageName, existingStorageResourceGroup) .AddQueues("queues"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(queues); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx index 93bf04b410..ff85ded46b 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx @@ -106,7 +106,7 @@ var builder = DistributedApplication.CreateBuilder(args); var tables = builder.AddAzureStorage("storage") .AddTables("tables"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(tables) .WaitFor(tables); @@ -123,7 +123,7 @@ const builder = await createBuilder(); const tables = await builder.addAzureStorage("storage") .addTables("tables"); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(tables) .waitFor(tables); @@ -191,7 +191,7 @@ var storage = builder.AddAzureStorage("storage") var tables = storage.AddTables("tables"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(tables) .WaitFor(tables); @@ -210,7 +210,7 @@ const storage = await builder.addAzureStorage("storage") const tables = await storage.addTables("tables"); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(tables) .waitFor(tables); @@ -566,7 +566,7 @@ var storageAccount = builder.AddAzureStorage("storage") var tables = storageAccount.AddTables("tables"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(tables); // After adding all resources, run the app... @@ -587,7 +587,7 @@ const storageAccount = await builder.addAzureStorage("storage") const tables = await storageAccount.addTables("tables"); -await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj") +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .withReference(tables); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx index 663776ad05..464c303175 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx @@ -1011,7 +1011,7 @@ var queues = storage.AddQueues("queues"); peSubnet.AddPrivateEndpoint(blobs); peSubnet.AddPrivateEndpoint(queues); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints() .WithReference(blobs) .WithReference(queues); @@ -1055,7 +1055,7 @@ const queues = storage.addQueues("queues"); peSubnet.addPrivateEndpoint(blobs); peSubnet.addPrivateEndpoint(queues); -await builder.addProject("api", "../Api/Api.csproj") +await builder.addDotnetProject("api", "../Api/Api.csproj") .withExternalHttpEndpoints() .withReference(blobs) .withReference(queues); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx index 12cdaf3ebf..2c1c75c247 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var webPubSub = builder.AddAzureWebPubSub("web-pubsub"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(webPubSub); // After adding all resources, run the app... @@ -213,7 +213,7 @@ Event handlers allow your backend services to receive events from Azure Web PubS ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var worker = builder.AddProject("worker") +var worker = builder.AddDotnetProject("worker", "../WorkerService/WorkerService.csproj") .WithExternalHttpEndpoints(); var webPubSub = builder.AddAzureWebPubSub("web-pubsub"); @@ -281,7 +281,7 @@ var builder = DistributedApplication.CreateBuilder(args); var webPubSub = builder.AddAzureWebPubSub("web-pubsub"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithReference(webPubSub); // Assign WebPubSubServiceReader role (read-only access) @@ -355,7 +355,7 @@ var existingPubSubResourceGroup = builder.AddParameter("existingPubSubResourceGr var webPubSub = builder.AddAzureWebPubSub("web-pubsub") .AsExisting(existingPubSubName, existingPubSubResourceGroup); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(webPubSub); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/configure-container-apps.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/configure-container-apps.mdx index c9bda201cd..6726ec3a44 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/configure-container-apps.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/configure-container-apps.mdx @@ -228,7 +228,7 @@ var existingEnvResourceGroup = builder.AddParameter("existingEnvResourceGroup"); var acaEnv = builder.AddAzureContainerAppEnvironment("aca-env") .AsExisting(existingEnvName, existingEnvResourceGroup); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"); builder.Build().Run(); ``` @@ -245,7 +245,7 @@ const existingEnvResourceGroup = await builder.addParameter("existingEnvResource const acaEnv = await builder.addAzureContainerAppEnvironment("aca-env"); await acaEnv.asExisting(existingEnvName, { resourceGroup: existingEnvResourceGroup }); -await builder.addProject("api", "../ApiService/ApiService.csproj"); +await builder.addDotnetProject("api", "../ApiService/ApiService.csproj"); await builder.build().run(); ``` @@ -319,7 +319,7 @@ builder.AddAzureContainerAppEnvironment("aca-env") .WithAzureContainerRegistry(acr) .WithAcrPullIdentity(pullIdentity); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"); builder.Build().Run(); ``` @@ -346,7 +346,7 @@ await acaEnv.asExisting(existingEnvName, { resourceGroup: existingResourceGroup await acaEnv.withAzureContainerRegistry(acr); await acaEnv.withAcrPullIdentity(pullIdentity); -await builder.addProject("api", "../ApiService/ApiService.csproj"); +await builder.addDotnetProject("api", "../ApiService/ApiService.csproj"); await builder.build().run(); ``` @@ -435,7 +435,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddAzureContainerAppEnvironment("aca-env"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .PublishAsAzureContainerApp((infrastructure, containerApp) => { containerApp.Template.Value!.Scale = new ContainerAppScale diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/container-app-jobs.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/container-app-jobs.mdx index 903d33e8b9..8d33f289c6 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/container-app-jobs.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/container-app-jobs.mdx @@ -17,7 +17,7 @@ import ApiReference from '@components/ApiReference.astro'; data-zoom-off /> -[Azure Container Apps jobs](https://learn.microsoft.com/azure/container-apps/jobs) let you run containerized tasks that execute for a finite duration and exit. Unlike continuously-running Container Apps, jobs are purpose-built for batch processing, scheduled tasks, and event-driven workloads. The Aspire Azure Container App Jobs hosting integration exposes and extension methods so you can declare any `ProjectResource`, `ContainerResource`, or `ExecutableResource` as an Azure Container App Job directly from your [`AppHost`](/get-started/app-host/). +[Azure Container Apps jobs](https://learn.microsoft.com/azure/container-apps/jobs) let you run containerized tasks that execute for a finite duration and exit. Unlike continuously-running Container Apps, jobs are purpose-built for batch processing, scheduled tasks, and event-driven workloads. The Aspire Azure Container App Jobs hosting integration exposes and extension methods so you can declare any `ContainerResource` or `ExecutableResource`, including a `DotnetProjectResource`, as an Azure Container App Job directly from your [`AppHost`](/get-started/app-host/). ## Supported resource types @@ -25,7 +25,7 @@ The following resource types can be published as Azure Container App Jobs: | Resource type | Description | |---|---| -| `ProjectResource` | A .NET project added via . | +| `DotnetProjectResource` | A .NET project or C# file-based app added via . | | `ContainerResource` | A container image added via . | | `ExecutableResource` | An executable process added via . | @@ -38,7 +38,7 @@ Use `PublishAsAzureContainerAppJob` to deploy a project, container, or executabl ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("data-processor") +builder.AddDotnetProject("data-processor", "../DataProcessor/DataProcessor.csproj") .PublishAsScheduledAzureContainerAppJob("0 0 * * *"); // Every day at midnight ``` @@ -48,7 +48,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const dataProcessor = await builder.addProject("data-processor", "../DataProcessor/DataProcessor.csproj"); +const dataProcessor = await builder.addDotnetProject("data-processor", "../DataProcessor/DataProcessor.csproj"); await dataProcessor.publishAsScheduledAzureContainerAppJob("0 0 * * *"); // Every day at midnight ``` @@ -94,7 +94,7 @@ Azure Container App Jobs support three trigger types: **manual**, **schedule**, ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("manual-task") +builder.AddDotnetProject("manual-task", "../ManualTask/ManualTask.csproj") .PublishAsAzureContainerAppJob((_, job) => { job.Configuration.TriggerType = ContainerAppJobTriggerType.Manual; @@ -115,7 +115,7 @@ builder.AddProject("manual-task") ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("scheduled-task") +builder.AddDotnetProject("scheduled-task", "../ScheduledTask/ScheduledTask.csproj") .PublishAsAzureContainerAppJob((_, job) => { job.Configuration.TriggerType = ContainerAppJobTriggerType.Schedule; @@ -139,7 +139,7 @@ builder.AddProject("scheduled-task") ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("event-task") +builder.AddDotnetProject("event-task", "../EventDrivenTask/EventDrivenTask.csproj") .PublishAsAzureContainerAppJob((_, job) => { job.Configuration.TriggerType = ContainerAppJobTriggerType.Event; @@ -168,7 +168,7 @@ Configure CPU and memory for your job: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("intensive-task") +builder.AddDotnetProject("intensive-task", "../ResourceIntensiveTask/ResourceIntensiveTask.csproj") .PublishAsAzureContainerAppJob((_, job) => { job.Configuration.TriggerType = ContainerAppJobTriggerType.Manual; @@ -195,7 +195,7 @@ var builder = DistributedApplication.CreateBuilder(args); var connectionString = builder.AddParameter("connectionString"); -builder.AddProject("db-task") +builder.AddDotnetProject("db-task", "../DatabaseTask/DatabaseTask.csproj") .PublishAsAzureContainerAppJob((infra, job) => { job.Configuration.TriggerType = ContainerAppJobTriggerType.Manual; @@ -221,7 +221,7 @@ builder.AddProject("db-task") ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("retryable-task") +builder.AddDotnetProject("retryable-task", "../RetryableTask/RetryableTask.csproj") .PublishAsAzureContainerAppJob((_, job) => { job.Configuration.TriggerType = ContainerAppJobTriggerType.Manual; diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx index ad965aaab3..e337284f36 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx @@ -187,7 +187,7 @@ const builder = await createBuilder(); const identity = await builder.addAzureUserAssignedIdentity("identity"); const clientId = await identity.getOutput("clientId"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withEnvironment("IDENTITY_CLIENT_ID", clientId); await builder.build().run(); @@ -201,7 +201,7 @@ var builder = DistributedApplication.CreateBuilder(args); var identity = builder.AddAzureUserAssignedIdentity("identity"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment("IDENTITY_CLIENT_ID", identity.Resource.ClientId); builder.Build().Run(); @@ -946,7 +946,7 @@ await storage.withParameter('storageAccountName', { const storageAccountName = await storage.getOutput('storageAccountName'); -const webapp = await builder.addProject('webapp', '../WebApp/WebApp.csproj'); +const webapp = await builder.addDotnetProject('webapp', '../WebApp/WebApp.csproj'); await webapp.withEnvironment('STORAGE_ACCOUNT_NAME', storageAccountName); await builder.build().run(); @@ -962,7 +962,7 @@ var builder = DistributedApplication.CreateBuilder(args); var storage = builder.AddBicepTemplate("storage", "./custom-storage.bicep") .WithParameter("storageAccountName", "mystorageaccount"); -builder.AddProject("webapp") +builder.AddDotnetProject("webapp", "../WebApp/WebApp.csproj") .WithEnvironment("STORAGE_ACCOUNT_NAME", storage.GetOutput("storageAccountName")); builder.Build().Run(); @@ -1064,7 +1064,7 @@ await sql.withParameter('administratorLoginPassword', { value: adminPassword }); const sqlServerName = await sql.getOutput('sqlServerName'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withEnvironment('SQL_SERVER_NAME', sqlServerName); await builder.build().run(); @@ -1082,7 +1082,7 @@ var adminPassword = builder.AddParameter("adminPassword", secret: true); var sql = builder.AddBicepTemplate("sql", "./custom-sql.bicep") .WithParameter("administratorLoginPassword", adminPassword); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithEnvironment("SQL_SERVER_NAME", sql.GetOutput("sqlServerName")); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/local-provisioning.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/local-provisioning.mdx index f6dfc7e57f..0d33d4f583 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/local-provisioning.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/local-provisioning.mdx @@ -156,7 +156,7 @@ var builder = DistributedApplication.CreateBuilder(args); var storage = builder.AddAzureStorage("storage"); var blobs = storage.AddBlobs("blobs"); -builder.AddProject("webapp") +builder.AddDotnetProject("webapp", "../WebApp/WebApp.csproj") .WithReference(blobs); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/overview.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/overview.mdx index 38413bce20..98c84f2c3a 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/overview.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/overview.mdx @@ -36,7 +36,7 @@ const storage = await builder.addAzureStorage('storage'); await storage.runAsEmulator(); const blobs = await storage.addBlobs('blobs'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(blobs); await api.waitFor(blobs); @@ -53,7 +53,7 @@ var blobs = builder.AddAzureStorage("storage") .RunAsEmulator() .AddBlobs("blobs"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(blobs) .WaitFor(blobs); @@ -521,7 +521,7 @@ var storage = builder.ExecutionContext.IsPublishMode ? builder.AddAzureStorage("storage") : builder.AddConnectionString("storage"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(storage); // After adding all resources, run the app... @@ -598,15 +598,14 @@ Aspire deploys compute resources to [Azure Container Apps](https://learn.microso - `ContainerResource`: Represents a specified container. - `ExecutableResource`: Represents a specified executable process. -- `ProjectResource`: Represents a specified .NET project. +- `DotnetProjectResource`: Represents a .NET project or C# file-based app. It's an executable resource. Add an ACA environment with to target these resources to Azure Container Apps. Use the following APIs when you want to customize the generated Container App resource for a specific resource: - `PublishAsAzureContainerApp` for containers -- `PublishAsAzureContainerApp` for executables -- `PublishAsAzureContainerApp` for projects +- `PublishAsAzureContainerApp` for executables, including .NET projects You don't need `PublishAsAzureContainerApp` for a standard ACA deployment. Use it only when you want to customize the generated Container App resource. As an example, consider the following code: @@ -617,7 +616,7 @@ var env = builder.AddParameter("env"); builder.AddAzureContainerAppEnvironment("aca-env"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../AspireApi/AspireApi.csproj") .PublishAsAzureContainerApp((infra, app) => { app.Template.Containers[0].Value!.Env.Add(new ContainerAppEnvironmentVariable diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx index 93ff47524c..2e31b1bdf3 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx @@ -31,7 +31,7 @@ var builder = DistributedApplication.CreateBuilder(args); var search = builder.AddAzureSearch("search"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(search); ```` @@ -45,7 +45,7 @@ const builder = await createBuilder(); const search = await builder.addAzureSearch("search"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(search); ```` @@ -94,7 +94,7 @@ var builder = DistributedApplication.CreateBuilder(args); var search = builder.AddAzureSearch("search"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithRoleAssignments(search, SearchBuiltInRole.SearchIndexDataReader) .WithReference(search); @@ -109,7 +109,7 @@ const builder = await createBuilder(); const search = await builder.addAzureSearch("search"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withSearchRoleAssignments(search, [AzureSearchRole.SearchIndexDataReader]); await api.withReference(search); ```` @@ -167,7 +167,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keyVault = builder.AddAzureKeyVault("vault"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(keyVault); builder.Pipeline.AddStep( diff --git a/src/frontend/src/content/docs/integrations/cloud/stripe/stripe-host.mdx b/src/frontend/src/content/docs/integrations/cloud/stripe/stripe-host.mdx index 803dd97c3f..0ec6f05a4d 100644 --- a/src/frontend/src/content/docs/integrations/cloud/stripe/stripe-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/stripe/stripe-host.mdx @@ -45,7 +45,7 @@ const builder = await createBuilder(); const apiKey = await builder.addParameter('stripe-api-key', { secret: true, }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); const stripe = await builder.addStripe('stripe', apiKey); await stripe.withListen(api, { @@ -64,7 +64,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var apiKey = builder.AddParameter("stripe-api-key", secret: true); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); var stripe = builder.AddStripe("stripe", apiKey) .WithListen(api, webhookPath: "/webhooks/stripe"); @@ -105,7 +105,7 @@ const builder = await createBuilder(); const apiKey = await builder.addParameter('stripe-api-key', { secret: true, }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); const webhookEndpoint = await builder.addExternalService( 'webhook-endpoint', 'http://host.docker.internal:5082' @@ -132,7 +132,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var apiKey = builder.AddParameter("stripe-api-key", secret: true); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); var webhookEndpoint = builder.AddExternalService( "webhook-endpoint", "http://host.docker.internal:5082"); diff --git a/src/frontend/src/content/docs/integrations/compute/docker.mdx b/src/frontend/src/content/docs/integrations/compute/docker.mdx index 6a7ea41d95..61d229999c 100644 --- a/src/frontend/src/content/docs/integrations/compute/docker.mdx +++ b/src/frontend/src/content/docs/integrations/compute/docker.mdx @@ -102,14 +102,14 @@ var cache = builder.AddRedis("cache") service.Name = "redis"; }); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache) .PublishAsDockerComposeService((resource, service) => { service.Name = "api"; }); -var web = builder.AddProject("web") +var web = builder.AddDotnetProject("web", "../Web/Web.csproj") .WithReference(cache) .WithReference(api) .PublishAsDockerComposeService((resource, service) => @@ -133,13 +133,13 @@ await cache.publishAsDockerComposeService(async (resource, service) => { await service.name.set("redis"); }); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(cache); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set("api"); }); -const web = await builder.addProject("web", "../Web/Web.csproj"); +const web = await builder.addDotnetProject("web", "../Web/Web.csproj"); await web.withReference(cache); await web.withReference(api); await web.publishAsDockerComposeService(async (resource, service) => { @@ -207,7 +207,7 @@ When a Docker Compose environment is present, all resources are automatically pu ```csharp title="AppHost.cs" var compose = builder.AddDockerComposeEnvironment("compose"); - builder.AddProject("api") + builder.AddDotnetProject("api", "../Api/Api.csproj") .WithComputeEnvironment(compose); ``` @@ -215,7 +215,7 @@ When a Docker Compose environment is present, all resources are automatically pu ```typescript title="apphost.mts" const compose = await builder.addDockerComposeEnvironment("compose"); - const api = await builder.addProject("api", "../Api/Api.csproj"); + const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withComputeEnvironment(compose); ``` @@ -797,7 +797,7 @@ Use { service.Name = "api"; }) .WithRemoteImageName("myorg/myapi") .WithRemoteImageTag("v1.0.0"); @@ -812,7 +812,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set("api"); }); @@ -847,7 +847,7 @@ For more complex scenarios, use { service.Name = "api"; }) .WithImagePushOptions(context => { @@ -871,7 +871,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api .publishAsDockerComposeService(async (resource, service) => { await service.name.set("api"); @@ -919,7 +919,7 @@ For asynchronous operations (such as retrieving configuration from external sour var builder = DistributedApplication.CreateBuilder(args); #pragma warning disable ASPIREPIPELINES003 // WithImagePushOptions is an experimental API and may change in future releases. -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsDockerComposeService((resource, service) => { service.Name = "api"; }) .WithImagePushOptions(async context => { @@ -939,7 +939,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api .publishAsDockerComposeService(async (resource, service) => { await service.name.set("api"); @@ -1007,7 +1007,7 @@ var registry = builder.AddContainerRegistry( ); // Associate resources with the registry -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsDockerComposeService((resource, service) => { service.Name = "api"; }) .WithContainerRegistry(registry); @@ -1028,7 +1028,7 @@ const registry = await builder.addContainerRegistry( ); // Associate resources with the registry -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set("api"); }); @@ -1078,7 +1078,7 @@ var registry = builder.AddContainerRegistry( registryRepository ); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsDockerComposeService((resource, service) => { service.Name = "api"; }) .WithContainerRegistry(registry); #pragma warning restore ASPIRECOMPUTE003 @@ -1107,7 +1107,7 @@ const registry = await builder.addContainerRegistry( registryRepository ); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.publishAsDockerComposeService(async (resource, service) => { await service.name.set("api"); }); diff --git a/src/frontend/src/content/docs/integrations/compute/floci.mdx b/src/frontend/src/content/docs/integrations/compute/floci.mdx index 8cacd7cdb5..b95fbdf510 100644 --- a/src/frontend/src/content/docs/integrations/compute/floci.mdx +++ b/src/frontend/src/content/docs/integrations/compute/floci.mdx @@ -112,7 +112,7 @@ var builder = DistributedApplication.CreateBuilder(args); var aws = builder.AddFlociAws("floci-aws"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(aws) .WaitFor(aws); @@ -130,7 +130,7 @@ const builder = await createBuilder(); const aws = await builder.addFlociAws('floci-aws'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withFlociAwsReference(aws).waitFor(aws); await builder.build().run(); @@ -173,7 +173,7 @@ if err := app.Run(); err != nil { ```csharp title="AppHost.cs" var azure = builder.AddFlociAzure("floci-az"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(azure) .WaitFor(azure); ``` @@ -185,7 +185,7 @@ builder.AddProject("api") ```typescript title="apphost.mts" const azure = await builder.addFlociAzure('floci-az'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withFlociAzureReference(azure).waitFor(azure); ``` @@ -211,7 +211,7 @@ api.WithFlociAzureReference(azure).WaitFor(azure) ```csharp title="AppHost.cs" var gcp = builder.AddFlociGcp("floci-gcp", defaultProjectId: "my-project"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(gcp) .WaitFor(gcp); ``` @@ -225,7 +225,7 @@ const gcp = await builder.addFlociGcp('floci-gcp', { defaultProjectId: 'my-project', }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withFlociGcpReference(gcp).waitFor(gcp); ``` @@ -770,7 +770,7 @@ var azure = builder.AddFlociAzure("floci-az") #pragma warning restore ASPIRECERTIFICATES001 -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(aws) .WithReference(azure); ``` @@ -786,7 +786,7 @@ await aws.withHttpsDeveloperCertificate(); const azure = await builder.addFlociAzure('floci-az'); await azure.withHttpsDeveloperCertificate(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withFlociAwsReference(aws); await api.withFlociAzureReference(azure); ``` diff --git a/src/frontend/src/content/docs/integrations/compute/k3s.mdx b/src/frontend/src/content/docs/integrations/compute/k3s.mdx index 3fd96ddef8..a5b408f46a 100644 --- a/src/frontend/src/content/docs/integrations/compute/k3s.mdx +++ b/src/frontend/src/content/docs/integrations/compute/k3s.mdx @@ -149,7 +149,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cluster = builder.AddK3sCluster("k8s"); -builder.AddProject("operator") +builder.AddDotnetProject("operator", "../MyOperator/MyOperator.csproj") .WaitFor(cluster) .WithReference(cluster); // injects KUBECONFIG automatically @@ -167,7 +167,7 @@ const builder = await createBuilder(); const cluster = await builder.addK3sCluster('k8s'); await builder - .addProject('operator', '../MyOperator/MyOperator.csproj') + .addDotnetProject('operator', '../MyOperator/MyOperator.csproj') .withReference(cluster); // injects KUBECONFIG automatically await builder.build().run(); @@ -345,7 +345,7 @@ var podinfo = cluster.AddHelmRelease( .WithHelmValuesFile("./deploy/podinfo-values.yaml"); // Wait for the chart install to complete before starting the operator. -builder.AddProject("operator") +builder.AddDotnetProject("operator", "../MyOperator/MyOperator.csproj") .WaitForCompletion(podinfo) .WithReference(cluster); ``` @@ -361,7 +361,7 @@ const podinfo = await cluster.addHelmRelease('podinfo', 'podinfo', { }); // Wait for the chart install to complete before starting the operator. -const operator = await builder.addProject('operator', '../MyOperator/MyOperator.csproj'); +const operator = await builder.addDotnetProject('operator', '../MyOperator/MyOperator.csproj'); await operator.waitForCompletion(podinfo); await operator.withReference(cluster); ``` @@ -460,7 +460,7 @@ var podinfoWeb = cluster .WaitForCompletion(podinfo); // Host processes receive http://localhost:{port} -builder.AddProject("api") +builder.AddDotnetProject("api", "../MyApi/MyApi.csproj") .WaitFor(podinfoWeb) .WithReference(podinfoWeb); @@ -481,7 +481,7 @@ const podinfoWeb = await cluster // Host processes receive http://localhost:{port} await builder - .addProject('api', '../MyApi/MyApi.csproj') + .addDotnetProject('api', '../MyApi/MyApi.csproj') .withReference(podinfoWeb); // DCP-network containers receive http://host.docker.internal:{port} @@ -524,7 +524,7 @@ Both `K3sClusterResource` and `K3sServiceEndpointResource` implement `IResourceW ```csharp title="AppHost.cs" // Projects and executables receive KUBECONFIG pointing to the host-accessible variant -builder.AddProject("operator") +builder.AddDotnetProject("operator", "../MyOperator/MyOperator.csproj") .WithReference(cluster); // KUBECONFIG=…/.k3s/k8s/local/kubeconfig.yaml // Containers receive a bind-mounted kubeconfig at /tmp/k3s-kubeconfig.yaml @@ -545,10 +545,10 @@ using var client = new Kubernetes(config); ```typescript title="apphost.mts" // Standard withReference — injects KUBECONFIG or services__name__url -const operator = await builder.addProject('operator', '../MyOperator/MyOperator.csproj'); +const operator = await builder.addDotnetProject('operator', '../MyOperator/MyOperator.csproj'); await operator.withReference(cluster); -const api = await builder.addProject('api', '../MyApi/MyApi.csproj'); +const api = await builder.addDotnetProject('api', '../MyApi/MyApi.csproj'); await api.withReference(podinfoWeb); ``` diff --git a/src/frontend/src/content/docs/integrations/compute/kind/kind-host.mdx b/src/frontend/src/content/docs/integrations/compute/kind/kind-host.mdx index dfd0e16366..6c63663dbd 100644 --- a/src/frontend/src/content/docs/integrations/compute/kind/kind-host.mdx +++ b/src/frontend/src/content/docs/integrations/compute/kind/kind-host.mdx @@ -286,7 +286,7 @@ const builder = await createBuilder(); const cluster = await builder.addKindCluster('mycluster'); const operator = await builder - .addProject('operator', '../Operator/Operator.csproj') + .addDotnetProject('operator', '../Operator/Operator.csproj') .withKindClusterReference(cluster); await builder.build().run(); @@ -300,7 +300,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cluster = builder.AddKindCluster("mycluster"); -var operatorApp = builder.AddProject("operator") +var operatorApp = builder.AddDotnetProject("operator", "../Operator/Operator.csproj") .WithReference(cluster); // After adding all resources, run the app... @@ -629,7 +629,7 @@ const k8s = await builder .withKubernetesVersion('v1.32.2'); await builder.addContainer('redis', 'redis:7'); -await builder.addProject('api', '../Api/Api.csproj'); +await builder.addDotnetProject('api', '../Api/Api.csproj'); await builder.build().run(); ``` @@ -645,7 +645,7 @@ builder.AddKubernetesEnvironment("k8s") .WithKubernetesVersion("v1.32.2"); builder.AddContainer("redis", "redis", "7"); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../Api/Api.csproj"); // After adding all resources, run the app... builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx b/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx index 7329d7df40..4c78dc984a 100644 --- a/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx +++ b/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx @@ -107,7 +107,7 @@ var builder = DistributedApplication.CreateBuilder(args); var k8s = builder.AddKubernetesEnvironment("k8s"); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); builder.Build().Run(); ``` @@ -180,7 +180,7 @@ The dashboard container included in the generated Helm chart opts out of dashboa ```csharp title="AppHost.cs" var k8s = builder.AddKubernetesEnvironment("k8s"); - builder.AddProject("api") + builder.AddDotnetProject("api", "../MyApi/MyApi.csproj") .WithComputeEnvironment(k8s); ``` @@ -453,7 +453,7 @@ var builder = DistributedApplication.CreateBuilder(args); builder.AddKubernetesEnvironment("k8s"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishAsKubernetesService(resource => { var container = resource.Workload!.PodTemplate.Spec.Containers[0]; diff --git a/src/frontend/src/content/docs/integrations/custom-integrations/client-integrations.mdx b/src/frontend/src/content/docs/integrations/custom-integrations/client-integrations.mdx index 2bb3ace4c2..7a17c7ac20 100644 --- a/src/frontend/src/content/docs/integrations/custom-integrations/client-integrations.mdx +++ b/src/frontend/src/content/docs/integrations/custom-integrations/client-integrations.mdx @@ -570,7 +570,7 @@ var builder = DistributedApplication.CreateBuilder(args); var maildev = builder.AddMailDev("maildev"); -builder.AddProject("newsletterservice") +builder.AddDotnetProject("newsletterservice", "../MailDevResource.NewsletterService/MailDevResource.NewsletterService.csproj") .WithUrlForEndpoint("https", e => { e.DisplayText = "Scalar"; diff --git a/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx b/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx index 3ca1b81193..b186d62249 100644 --- a/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx +++ b/src/frontend/src/content/docs/integrations/custom-integrations/hosting-integrations.mdx @@ -34,7 +34,7 @@ var redis = builder.AddRedis("cache"); var db = builder.AddPostgres("pgserver") .AddDatabase("inventorydb"); -builder.AddProject("inventoryservice") +builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj") .WithReference(redis) .WithReference(db); ``` @@ -189,7 +189,7 @@ var builder = DistributedApplication.CreateBuilder(args); var maildev = builder.AddMailDev("maildev"); -builder.AddProject("newsletterservice") +builder.AddDotnetProject("newsletterservice", "../NewsletterService/NewsletterService.csproj") .WithReference(maildev); ``` @@ -419,7 +419,7 @@ var builder = DistributedApplication.CreateBuilder(args); var maildev = builder.AddMailDev("maildev"); -builder.AddProject("newsletterservice") +builder.AddDotnetProject("newsletterservice", "../MailDevResource.NewsletterService/MailDevResource.NewsletterService.csproj") .WithReference(maildev); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/custom-integrations/secure-communication.mdx b/src/frontend/src/content/docs/integrations/custom-integrations/secure-communication.mdx index 1364fcb1e7..687c924a18 100644 --- a/src/frontend/src/content/docs/integrations/custom-integrations/secure-communication.mdx +++ b/src/frontend/src/content/docs/integrations/custom-integrations/secure-communication.mdx @@ -200,7 +200,7 @@ var maildev = builder.AddMailDev( username: mailDevUsername, password: mailDevPassword); -builder.AddProject("newsletterservice") +builder.AddDotnetProject("newsletterservice", "../MailDevResource.NewsletterService/MailDevResource.NewsletterService.csproj") .WithReference(maildev); builder.Build().Run(); @@ -227,7 +227,7 @@ const maildev = await builder.addMailDev('maildev', { password: mailDevPassword }); -await builder.addCSharpApp('newsletterservice', './NewsletterService') +await builder.addDotnetProject('newsletterservice', './NewsletterService') .withReference(maildev); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/chroma/chroma-host.mdx b/src/frontend/src/content/docs/integrations/databases/chroma/chroma-host.mdx index 62760b3793..31583643cd 100644 --- a/src/frontend/src/content/docs/integrations/databases/chroma/chroma-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/chroma/chroma-host.mdx @@ -42,7 +42,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const chroma = await builder.addChroma('chroma'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(chroma); await api.waitFor(chroma); @@ -56,7 +56,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var chroma = builder.AddChroma("chroma"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(chroma) .WaitFor(chroma); diff --git a/src/frontend/src/content/docs/integrations/databases/clickhouse/clickhouse-host.mdx b/src/frontend/src/content/docs/integrations/databases/clickhouse/clickhouse-host.mdx index 5deb99038b..6de8dcda47 100644 --- a/src/frontend/src/content/docs/integrations/databases/clickhouse/clickhouse-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/clickhouse/clickhouse-host.mdx @@ -59,7 +59,7 @@ var builder = DistributedApplication.CreateBuilder(args); var clickhouse = builder.AddClickHouse("clickhouse"); var clickhousedb = clickhouse.AddDatabase("clickhousedb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(clickhousedb) .WaitFor(clickhousedb); @@ -106,7 +106,7 @@ var clickhouse = builder.AddClickHouse("clickhouse") var clickhousedb = clickhouse.AddDatabase("clickhousedb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(clickhousedb) .WaitFor(clickhousedb); @@ -135,7 +135,7 @@ var clickhouse = builder.AddClickHouse("clickhouse") var clickhousedb = clickhouse.AddDatabase("clickhousedb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(clickhousedb) .WaitFor(clickhousedb); @@ -161,7 +161,7 @@ var password = builder.AddParameter("password", secret: true); var clickhouse = builder.AddClickHouse("clickhouse", userName: username, password: password); var clickhousedb = clickhouse.AddDatabase("clickhousedb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(clickhousedb) .WaitFor(clickhousedb); diff --git a/src/frontend/src/content/docs/integrations/databases/duckdb/duckdb-host.mdx b/src/frontend/src/content/docs/integrations/databases/duckdb/duckdb-host.mdx index 3813d82e4c..1fcfa84530 100644 --- a/src/frontend/src/content/docs/integrations/databases/duckdb/duckdb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/duckdb/duckdb-host.mdx @@ -38,7 +38,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const analytics = await builder.addDuckDB('analytics'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(analytics); await builder.build().run(); @@ -51,7 +51,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var analytics = builder.AddDuckDB("analytics"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(analytics); // After adding all resources, run the app... @@ -82,7 +82,7 @@ const analytics = await builder.addDuckDB('analytics', { databasePath, databaseFileName: 'analytics.duckdb', }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(analytics); await builder.build().run(); @@ -99,7 +99,7 @@ var analytics = builder.AddDuckDB( "analytics", databasePath: databasePath, databaseFileName: "analytics.duckdb"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(analytics); // After adding all resources, run the app... @@ -138,7 +138,7 @@ const analytics = await builder.addDuckDB('analytics', { }); await analytics.withReadOnly(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(analytics); await builder.build().run(); @@ -155,7 +155,7 @@ var analytics = builder.AddDuckDB( databasePath: Path.Combine(builder.AppHostDirectory, "data"), databaseFileName: "warehouse.duckdb") .WithReadOnly(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(analytics); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/azure-cosmos-db/azure-cosmos-db-host.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/azure-cosmos-db/azure-cosmos-db-host.mdx index ec9b4d4b6b..4c19e32268 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/azure-cosmos-db/azure-cosmos-db-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/azure-cosmos-db/azure-cosmos-db-host.mdx @@ -166,7 +166,7 @@ var cosmos = builder.AddAzureCosmosDB("cosmos-db"); var db = cosmos.AddCosmosDatabase("db"); var container = db.AddContainer("entries", "/id"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WaitFor(container) .WithReference(container); @@ -183,7 +183,7 @@ const cosmos = await builder.addAzureCosmosDB("cosmos-db"); const db = await cosmos.addCosmosDatabase("db"); const container = await db.addContainer("entries", "/id"); -await builder.addProject("apiservice", { projectPath: "../ExampleProject/ExampleProject.csproj" }) +await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .waitFor(container) .withReference(container); @@ -300,7 +300,7 @@ var existingCosmosResourceGroup = builder.AddParameter("existingCosmosResourceGr var cosmosdb = builder.AddAzureCosmosDB("cosmos-db") .AsExisting(existingCosmosName, existingCosmosResourceGroup); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(cosmosdb); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx index 3ae4aca15f..c15387141d 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sql = builder.AddAzureSqlServer("sql"); var db = sql.AddDatabase("database"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("myservice", "../MyService/MyService.csproj") .WithReference(db); // After adding all resources, run the app... @@ -201,7 +201,7 @@ var sql = builder.AddAzureSqlServer("sql") .AsExisting(existingName, existingResourceGroup) .AddDatabase("database"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(sql); // After adding all resources, run the app... @@ -283,7 +283,7 @@ var sql = builder.AddAzureSqlServer("sql") var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/migrations.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/migrations.mdx index 4035eefc77..664a16c675 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/migrations.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/migrations.mdx @@ -176,7 +176,7 @@ If you get an error like "No database provider has been configured for this DbCo :::tip -The connection string name must match what you use in your AppHost. For example, if you use `builder.AddProject().WithReference(sqlServer.AddDatabase("ticketdb"))`, then use "ticketdb" as the connection string name. +The connection string name must match what you use in your AppHost. For example, if you use `builder.AddDotnetProject("supportticketapi-api", "../SupportTicketApi.Api/SupportTicketApi.Api.csproj").WithReference(sqlServer.AddDatabase("ticketdb"))`, then use "ticketdb" as the connection string name. ::: ### Multiple databases in one solution @@ -380,11 +380,11 @@ The migration service is created, but it needs to be added to the Aspire AppHost var sql = builder.AddSqlServer("sql") .AddDatabase("sqldata"); - var migrations = builder.AddProject("migrations") + var migrations = builder.AddDotnetProject("migrations", "../SupportTicketApi.MigrationService/SupportTicketApi.MigrationService.csproj") .WithReference(sql) .WaitFor(sql); - builder.AddProject("api") + builder.AddDotnetProject("api", "../SupportTicketApi.Api/SupportTicketApi.Api.csproj") .WithReference(sql) .WithReference(migrations) .WaitForCompletion(migrations); @@ -438,18 +438,18 @@ Create a dedicated migration service for each database. This approach provides b var firstDb = sqlServer.AddDatabase("firstdb"); var secondDb = postgres.AddDatabase("seconddb"); - var firstMigrations = builder.AddProject() + var firstMigrations = builder.AddDotnetProject("firstservice-migrationservice", "../FirstService.MigrationService/FirstService.MigrationService.csproj") .WithReference(firstDb); - var secondMigrations = builder.AddProject() + var secondMigrations = builder.AddDotnetProject("secondservice-migrationservice", "../SecondService.MigrationService/SecondService.MigrationService.csproj") .WithReference(secondDb); // Ensure services wait for their respective migrations - builder.AddProject() + builder.AddDotnetProject("firstservice-api", "../FirstService.Api/FirstService.Api.csproj") .WithReference(firstDb) .WaitFor(firstMigrations); - builder.AddProject() + builder.AddDotnetProject("secondservice-api", "../SecondService.Api/SecondService.Api.csproj") .WithReference(secondDb) .WaitFor(secondMigrations); ``` @@ -564,7 +564,7 @@ Call `AddEFMigrations` on any project resource that hosts an EF Core `DbContext` ```csharp title="AppHost.cs" var db = builder.AddPostgres("pg").AddDatabase("appdb"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(db); var apiMigrations = api.AddEFMigrations("api-migrations"); @@ -623,7 +623,7 @@ Pass `publishContainer: true` to `PublishAsMigrationBundle` to wrap the generate ```csharp title="AppHost.cs" var db = builder.AddPostgres("pg").AddDatabase("appdb"); -var api = builder.AddProject("api").WithReference(db); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj").WithReference(db); var apiMigrations = api.AddEFMigrations("api-migrations") .WithReference(db) diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/oracle/oracle-host.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/oracle/oracle-host.mdx index c0b1632062..242d09750d 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/oracle/oracle-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/oracle/oracle-host.mdx @@ -63,7 +63,7 @@ var oracle = builder.AddOracle("oracle") var oracledb = oracle.AddDatabase("oracledb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(oracledb) .WaitFor(oracledb); @@ -102,7 +102,7 @@ var oracle = builder.AddOracle("oracle", password) var oracledb = oracle.AddDatabase("oracledb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(oracledb) .WaitFor(oracledb); ``` @@ -132,7 +132,7 @@ var oracle = builder.AddOracle("oracle") var oracledb = oracle.AddDatabase("oracledb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(oracledb) .WaitFor(oracledb); @@ -157,7 +157,7 @@ var oracle = builder.AddOracle("oracle") var oracledb = oracle.AddDatabase("oracledb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(oracledb) .WaitFor(oracledb); diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/sqlite.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/sqlite.mdx index 6e6e57dadc..8661e415c6 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/sqlite.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/sqlite.mdx @@ -55,7 +55,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const sqlite = await builder.addSqlite('sqlite'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(sqlite); await builder.build().run(); @@ -68,7 +68,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var sqlite = builder.AddSqlite("sqlite"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(sqlite); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-extensions.mdx index edb7839220..8ed35e1b4a 100644 --- a/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-extensions.mdx @@ -46,7 +46,7 @@ var builder = DistributedApplication.CreateBuilder(args); var elasticsearch = builder.AddElasticsearch("elasticsearch") .WithElasticvue(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(elasticsearch); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx b/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx index ebb11c9f9a..9882154c9b 100644 --- a/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx @@ -86,7 +86,7 @@ var builder = DistributedApplication.CreateBuilder(args); var elasticsearch = builder.AddElasticsearch("elasticsearch"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(elasticsearch); // After adding all resources, run the app... @@ -123,7 +123,7 @@ var builder = DistributedApplication.CreateBuilder(args); var elasticsearch = builder.AddElasticsearch("elasticsearch") .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(elasticsearch); // After adding all resources, run the app... @@ -150,7 +150,7 @@ var elasticsearch = builder.AddElasticsearch("elasticsearch") source: @"C:\Elasticsearch\Data", isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(elasticsearch); // After adding all resources, run the app... @@ -180,7 +180,7 @@ var password = builder.AddParameter("password", secret: true); var elasticsearch = builder.AddElasticsearch("elasticsearch", password: password); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(elasticsearch); // After adding all resources, run the app... @@ -204,7 +204,7 @@ var builder = DistributedApplication.CreateBuilder(args); var elasticsearch = builder.AddConnectionString("elasticsearch"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(elasticsearch); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/kurrentdb/kurrentdb-host.mdx b/src/frontend/src/content/docs/integrations/databases/kurrentdb/kurrentdb-host.mdx index 8077b3462e..8ef3d68bc9 100644 --- a/src/frontend/src/content/docs/integrations/databases/kurrentdb/kurrentdb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/kurrentdb/kurrentdb-host.mdx @@ -103,7 +103,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kurrentdb = builder.AddKurrentDB("kurrentdb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kurrentdb); builder.Build().Run(); @@ -119,7 +119,7 @@ const builder = await createBuilder(); const kurrentdb = await builder.addKurrentDB("kurrentdb"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(kurrentdb); await builder.build().run(); @@ -186,7 +186,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kurrentdb = builder.AddKurrentDB("kurrentdb") .WithDataVolume(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kurrentdb); builder.Build().Run(); @@ -203,7 +203,7 @@ const builder = await createBuilder(); const kurrentdb = await builder.addKurrentDB("kurrentdb"); await kurrentdb.withDataVolume(); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(kurrentdb); await builder.build().run(); @@ -261,7 +261,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kurrentdb = builder.AddKurrentDB("kurrentdb") .WithDataBindMount(source: @"C:\KurrentDB\Data"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kurrentdb); builder.Build().Run(); @@ -278,7 +278,7 @@ const builder = await createBuilder(); const kurrentdb = await builder.addKurrentDB("kurrentdb"); await kurrentdb.withDataBindMount("C:\\KurrentDB\\Data"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(kurrentdb); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx b/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx index bff8df8406..d780ee9d3a 100644 --- a/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx @@ -108,7 +108,7 @@ var builder = DistributedApplication.CreateBuilder(args); var meilisearch = builder.AddMeilisearch("meilisearch"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(meilisearch); builder.Build().Run(); @@ -124,7 +124,7 @@ const builder = await createBuilder(); const meilisearch = await builder.addMeilisearch("meilisearch"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(meilisearch); await builder.build().run(); @@ -193,7 +193,7 @@ var builder = DistributedApplication.CreateBuilder(args); var meilisearch = builder.AddMeilisearch("meilisearch") .WithDataVolume(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(meilisearch); builder.Build().Run(); @@ -210,7 +210,7 @@ const builder = await createBuilder(); const meilisearch = await builder.addMeilisearch("meilisearch"); await meilisearch.withDataVolume(); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(meilisearch); await builder.build().run(); @@ -268,7 +268,7 @@ var builder = DistributedApplication.CreateBuilder(args); var meilisearch = builder.AddMeilisearch("meilisearch") .WithDataBindMount(source: @"C:\Meilisearch\Data"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(meilisearch); builder.Build().Run(); @@ -285,7 +285,7 @@ const builder = await createBuilder(); const meilisearch = await builder.addMeilisearch("meilisearch"); await meilisearch.withDataBindMount("C:\\Meilisearch\\Data"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(meilisearch); await builder.build().run(); @@ -348,7 +348,7 @@ var masterKey = builder.AddParameter("masterKey", secret: true); var meilisearch = builder.AddMeilisearch("meilisearch", masterKey); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(meilisearch); builder.Build().Run(); @@ -366,7 +366,7 @@ const masterKey = await builder.addParameter("masterKey", { secret: true }); const meilisearch = await builder.addMeilisearch("meilisearch", { masterKey }); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(meilisearch); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx b/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx index c44530928b..d035fa72b9 100644 --- a/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx @@ -108,7 +108,7 @@ var milvus = builder.AddMilvus("milvus") var milvusdb = milvus.AddDatabase("milvusdb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(milvusdb) .WaitFor(milvusdb); @@ -204,7 +204,7 @@ var milvus = builder.AddMilvus("milvus", apiKey) var milvusdb = milvus.AddDatabase("milvusdb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(milvusdb) .WaitFor(milvusdb); @@ -291,7 +291,7 @@ var milvus = builder.AddMilvus("milvus") var milvusdb = milvus.AddDatabase("milvusdb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(milvusdb) .WaitFor(milvusdb); @@ -366,7 +366,7 @@ var milvus = builder.AddMilvus("milvus") var milvusdb = milvus.AddDatabase("milvusdb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(milvusdb) .WaitFor(milvusdb); @@ -445,7 +445,7 @@ var milvus = builder.AddMilvus("milvus") var milvusdb = milvus.AddDatabase("milvusdb"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(milvusdb) .WaitFor(milvusdb); diff --git a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx index c2014d3efb..d891e54c6c 100644 --- a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx @@ -59,7 +59,7 @@ var builder = DistributedApplication.CreateBuilder(args); var mongodb = builder.AddMongoDB("mongodb") .WithDbGate(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb); builder.Build().Run(); @@ -76,7 +76,7 @@ const builder = await createBuilder(); const mongodb = await builder.addMongoDB('mongodb'); await mongodb.withDbGate(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(mongodb); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx index 3ec4d9542c..78087ee962 100644 --- a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx @@ -108,7 +108,7 @@ var mongo = builder.AddMongoDB("mongo") var mongodb = mongo.AddDatabase("mongodb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); @@ -349,7 +349,7 @@ var password = builder.AddParameter("password", secret: true); var mongo = builder.AddMongoDB("mongo", userName: username, password: password); var mongodb = mongo.AddDatabase("mongodb"); -var myService = builder.AddProject("apiservice") +var myService = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); @@ -446,7 +446,7 @@ var mongo = builder.AddMongoDB("mongo") var mongodb = mongo.AddDatabase("mongodb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); @@ -521,7 +521,7 @@ var mongo = builder.AddMongoDB("mongo") var mongodb = mongo.AddDatabase("mongodb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); @@ -590,7 +590,7 @@ var mongo = builder.AddMongoDB("mongo") var mongodb = mongo.AddDatabase("mongodb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); @@ -659,7 +659,7 @@ var mongo = builder.AddMongoDB("mongo").WithReplicaSet(); var mongodb = mongo.AddDatabase("mongodb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); @@ -788,7 +788,7 @@ var mongo = builder.AddMongoDB("mongo") var mongodb = mongo.AddDatabase("mongodb"); -var myService = builder.AddProject("apiservice") +var myService = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mongodb) .WaitFor(mongodb); diff --git a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx index 1ff645ffe4..4076c3809e 100644 --- a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx @@ -60,7 +60,7 @@ var builder = DistributedApplication.CreateBuilder(args); var mysql = builder.AddMySql("mysql") .WithDbGate(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(mysql); builder.Build().Run(); @@ -77,7 +77,7 @@ const builder = await createBuilder(); const mysql = await builder.addMySql('mysql'); await mysql.withDbGate(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(mysql); await builder.build().run(); @@ -125,7 +125,7 @@ var builder = DistributedApplication.CreateBuilder(args); var mysql = builder.AddMySql("mysql") .WithAdminer(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(mysql); builder.Build().Run(); @@ -142,7 +142,7 @@ const builder = await createBuilder(); const mysql = await builder.addMySql('mysql'); await mysql.withAdminer(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(mysql); await builder.build().run(); @@ -191,7 +191,7 @@ var mysql = builder.AddMySql("mysql") .WithDbGate() .WithAdminer(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(mysql); builder.Build().Run(); @@ -209,7 +209,7 @@ const mysql = await builder.addMySql('mysql'); await mysql.withDbGate(); await mysql.withAdminer(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(mysql); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx index 5cd5f3fce7..2778ce5b18 100644 --- a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx @@ -108,7 +108,7 @@ var mysql = builder.AddMySql("mysql") var mysqldb = mysql.AddDatabase("mysqldb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -195,7 +195,7 @@ var mysqldb = mysql.AddDatabase("mysqldb") ); """); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -221,7 +221,7 @@ const mysqldb = await mysql.addDatabase("mysqldb") ); `); -const myService = await builder.addProject("example", "../ExampleProject/ExampleProject.csproj"); +const myService = await builder.addDotnetProject("example", "../ExampleProject/ExampleProject.csproj"); await myService .withReference(mysqldb) .waitFor(mysqldb); @@ -278,7 +278,7 @@ var mysql = builder.AddMySql("mysql") var mysqldb = mysql.AddDatabase("mysqldb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -342,7 +342,7 @@ var mysql = builder.AddMySql("mysql") var mysqldb = mysql.AddDatabase("mysqldb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -410,7 +410,7 @@ var mysql = builder.AddMySql("mysql") var mysqldb = mysql.AddDatabase("mysqldb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -484,7 +484,7 @@ var mysql = builder.AddMySql("mysql") var mysqldb = mysql.AddDatabase("mysqldb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -550,7 +550,7 @@ var mysql = builder.AddMySql("mysql") var mysqldb = mysql.AddDatabase("mysqldb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); @@ -614,7 +614,7 @@ var mysql = builder.AddMySql("mysql", password) var mysqldb = mysql.AddDatabase("mysqldb"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(mysqldb) .WaitFor(mysqldb); diff --git a/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx b/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx index 7837581264..9149929580 100644 --- a/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx @@ -106,7 +106,7 @@ var builder = DistributedApplication.CreateBuilder(args); var postgres = builder.AddPostgres("postgres"); var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -190,7 +190,7 @@ var creationScript = $$""" var db = postgres.AddDatabase(databaseName) .WithCreationScript(creationScript); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -268,7 +268,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -331,7 +331,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -396,7 +396,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -457,7 +457,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -522,7 +522,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -593,7 +593,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -656,7 +656,7 @@ var postgres = builder.AddPostgres("postgres") var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... @@ -719,7 +719,7 @@ var password = builder.AddParameter("password", secret: true); var postgres = builder.AddPostgres("postgres", username, password); var postgresdb = postgres.AddDatabase("postgresdb"); -var exampleProject = builder.AddProject() +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgresdb); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx index 5e2f5b2277..7df4c61164 100644 --- a/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx @@ -61,7 +61,7 @@ var builder = DistributedApplication.CreateBuilder(args); var postgres = builder.AddPostgres("postgres") .WithDbGate(); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgres); // After adding all resources, run the app... @@ -78,7 +78,7 @@ const builder = await createBuilder(); const postgres = await builder.addPostgres('postgres'); await postgres.withDbGate(); -const exampleProject = await builder.addProject( +const exampleProject = await builder.addDotnetProject( 'example-project', '../ExampleProject/ExampleProject.csproj' ); @@ -123,7 +123,7 @@ var builder = DistributedApplication.CreateBuilder(args); var postgres = builder.AddPostgres("postgres") .WithAdminer(); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgres); // After adding all resources, run the app... @@ -140,7 +140,7 @@ const builder = await createBuilder(); const postgres = await builder.addPostgres('postgres'); await postgres.withAdminer(); -const exampleProject = await builder.addProject( +const exampleProject = await builder.addDotnetProject( 'example-project', '../ExampleProject/ExampleProject.csproj' ); @@ -186,7 +186,7 @@ var postgres = builder.AddPostgres("postgres") .WithDbGate() .WithAdminer(); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(postgres); // After adding all resources, run the app... @@ -204,7 +204,7 @@ const postgres = await builder.addPostgres('postgres'); await postgres.withDbGate(); await postgres.withAdminer(); -const exampleProject = await builder.addProject( +const exampleProject = await builder.addDotnetProject( 'example-project', '../ExampleProject/ExampleProject.csproj' ); @@ -318,7 +318,7 @@ var database = postgres.AddDatabase("appdb") migrations.WaitFor(database); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(database) .WaitFor(database) .WaitForCompletion(migrations); diff --git a/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx b/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx index 18c5e4b496..f680849008 100644 --- a/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var qdrant = builder.AddQdrant("qdrant") .WithLifetime(ContainerLifetime.Persistent); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(qdrant) .WaitFor(qdrant); @@ -181,7 +181,7 @@ var apiKey = builder.AddParameter("apiKey", secret: true); var qdrant = builder.AddQdrant("qdrant", apiKey) .WithLifetime(ContainerLifetime.Persistent); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(qdrant) .WaitFor(qdrant); @@ -252,7 +252,7 @@ var qdrant = builder.AddQdrant("qdrant") .WithDataVolume() .WithLifetime(ContainerLifetime.Persistent); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(qdrant) .WaitFor(qdrant); @@ -311,7 +311,7 @@ var qdrant = builder.AddQdrant("qdrant") .WithDataBindMount(source: @"C:\Qdrant\Data") .WithLifetime(ContainerLifetime.Persistent); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(qdrant) .WaitFor(qdrant); diff --git a/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx b/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx index e9c701a892..9a03704456 100644 --- a/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx @@ -109,7 +109,7 @@ var builder = DistributedApplication.CreateBuilder(args); var ravenServer = builder.AddRavenDB("ravenServer"); var ravendb = ravenServer.AddDatabase("ravendb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(ravendb) .WaitFor(ravendb); @@ -127,7 +127,7 @@ const builder = await createBuilder(); const ravenServer = await builder.addRavenDB("ravenServer"); const ravendb = await ravenServer.addDatabase("ravendb"); -const apiService = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await apiService.withReference(ravendb); await apiService.waitFor(ravendb); @@ -197,7 +197,7 @@ var builder = DistributedApplication.CreateBuilder(args); var ravenServer = builder.AddRavenDB("ravenServer"); var ravendb = ravenServer.AddDatabase("ravendb", ensureCreated: true); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(ravendb) .WaitFor(ravendb); @@ -215,7 +215,7 @@ const builder = await createBuilder(); const ravenServer = await builder.addRavenDB("ravenServer"); const ravendb = await ravenServer.addDatabase("ravendb", { ensureCreated: true }); -const apiService = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await apiService.withReference(ravendb); await apiService.waitFor(ravendb); @@ -265,7 +265,7 @@ var ravenServer = builder.AddRavenDB("ravenServer") var ravendb = ravenServer.AddDatabase("ravendb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(ravendb) .WaitFor(ravendb); @@ -285,7 +285,7 @@ await ravenServer.withDataVolume(); const ravendb = await ravenServer.addDatabase("ravendb"); -const apiService = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await apiService.withReference(ravendb); await apiService.waitFor(ravendb); @@ -339,7 +339,7 @@ var ravenServer = builder.AddRavenDB("ravenServer") var ravendb = ravenServer.AddDatabase("ravendb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(ravendb) .WaitFor(ravendb); @@ -359,7 +359,7 @@ await ravenServer.withDataBindMount("C:\\RavenDb\\Data"); const ravendb = await ravenServer.addDatabase("ravendb"); -const apiService = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await apiService.withReference(ravendb); await apiService.waitFor(ravendb); @@ -418,7 +418,7 @@ var ravenServer = builder.AddRavenDB("ravenServer") var ravendb = ravenServer.AddDatabase("ravendb"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(ravendb) .WaitFor(ravendb); @@ -439,7 +439,7 @@ await ravenServer.withLogVolume(); const ravendb = await ravenServer.addDatabase("ravendb"); -const apiService = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await apiService.withReference(ravendb); await apiService.waitFor(ravendb); @@ -495,7 +495,7 @@ var ravenServer = builder.AddRavenDB("ravenSecuredServer", serverSettings) var ravendb = ravenServer.AddDatabase("ravendbSecured"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(ravendb) .WaitFor(ravendb); diff --git a/src/frontend/src/content/docs/integrations/databases/rustfs/rustfs-host.mdx b/src/frontend/src/content/docs/integrations/databases/rustfs/rustfs-host.mdx index fb6c0df0b6..8909fa3f98 100644 --- a/src/frontend/src/content/docs/integrations/databases/rustfs/rustfs-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/rustfs/rustfs-host.mdx @@ -49,7 +49,7 @@ var builder = DistributedApplication.CreateBuilder(args); var rustfs = builder.AddRustFs("rustfs") .WithDataVolume(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(rustfs); // After adding all resources, run the app... @@ -225,7 +225,7 @@ var rustfs = builder.AddRustFs("rustfs") var images = rustfs.AddBucket("images"); var documents = rustfs.AddBucket("documents"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(images) .WithReference(documents); diff --git a/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-get-started.mdx b/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-get-started.mdx index 6d9ed2c3a5..629d7e8e4a 100644 --- a/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-get-started.mdx @@ -83,7 +83,7 @@ const seaweedfs = await builder.addSeaweedFS('seaweedfs'); await seaweedfs.withS3(); await seaweedfs.withDataVolume(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(seaweedfs); await builder.build().run(); @@ -99,7 +99,7 @@ var seaweedfs = builder.AddSeaweedFS("seaweedfs") .WithS3() .WithDataVolume(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(seaweedfs); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-host.mdx b/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-host.mdx index 2e36d7900f..3c1ad4a799 100644 --- a/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/seaweedfs/seaweedfs-host.mdx @@ -34,7 +34,7 @@ const builder = await createBuilder(); const seaweedfs = await builder.addSeaweedFS('seaweedfs'); await seaweedfs.withS3(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(seaweedfs); await builder.build().run(); @@ -49,7 +49,7 @@ var builder = DistributedApplication.CreateBuilder(args); var seaweedfs = builder.AddSeaweedFS("seaweedfs") .WithS3(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(seaweedfs); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/solr/solr-host.mdx b/src/frontend/src/content/docs/integrations/databases/solr/solr-host.mdx index 52940487bc..c084b9a172 100644 --- a/src/frontend/src/content/docs/integrations/databases/solr/solr-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/solr/solr-host.mdx @@ -40,7 +40,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const solr = await builder.addSolr('solr', { coreName: 'documents' }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(solr); await api.waitFor(solr); @@ -54,7 +54,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var solr = builder.AddSolr("solr", coreName: "documents"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(solr) .WaitFor(solr); diff --git a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx index 3ab421ee1b..56ec283ec9 100644 --- a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx @@ -60,7 +60,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlserver = builder.AddSqlServer("sqlserver") .WithDbGate(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(sqlserver); builder.Build().Run(); @@ -77,7 +77,7 @@ const builder = await createBuilder(); const sqlserver = await builder.addSqlServer('sqlserver'); await sqlserver.withDbGate(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(sqlserver); await builder.build().run(); @@ -125,7 +125,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlserver = builder.AddSqlServer("sqlserver") .WithAdminer(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(sqlserver); builder.Build().Run(); @@ -142,7 +142,7 @@ const builder = await createBuilder(); const sqlserver = await builder.addSqlServer('sqlserver'); await sqlserver.withAdminer(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(sqlserver); await builder.build().run(); @@ -191,7 +191,7 @@ var sqlserver = builder.AddSqlServer("sqlserver") .WithDbGate() .WithAdminer(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(sqlserver); builder.Build().Run(); @@ -209,7 +209,7 @@ const sqlserver = await builder.addSqlServer('sqlserver'); await sqlserver.withDbGate(); await sqlserver.withAdminer(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(sqlserver); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx index 7de4881f59..25d793da9c 100644 --- a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx @@ -108,7 +108,7 @@ var sql = builder.AddSqlServer("sql") var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -227,7 +227,7 @@ var creationScript = $$""" var db = sql.AddDatabase(databaseName) .WithCreationScript(creationScript); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -334,7 +334,7 @@ var sql = builder.AddSqlServer("sql") var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -409,7 +409,7 @@ var sql = builder.AddSqlServer("sql") var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -484,7 +484,7 @@ var password = builder.AddParameter("password", secret: true); var sql = builder.AddSqlServer("sql", password); var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -555,7 +555,7 @@ var sql = builder.AddSqlServer("sql") var db = sql.AddDatabase("database"); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -696,7 +696,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sql = builder.AddConnectionString("sql"); -var exampleProject = builder.AddProject("exampleproject") +var exampleProject = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(sql); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx index f6ecd5bade..7fb169a8f1 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -112,7 +112,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlite = builder.AddSqlite("sqlite"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(sqlite); builder.Build().Run(); @@ -128,7 +128,7 @@ const builder = await createBuilder(); const sqlite = await builder.addSqlite("sqlite"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(sqlite); await builder.build().run(); @@ -184,7 +184,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlite = builder.AddSqlite("sqlite", "C:\\Database\\Location", "my-database.db"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(sqlite); builder.Build().Run(); @@ -203,7 +203,7 @@ const sqlite = await builder.addSqlite("sqlite", { databaseFileName: "my-database.db", }); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(sqlite); await builder.build().run(); @@ -251,7 +251,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sqlite = builder.AddSqlite("sqlite") .WithSqliteWeb(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(sqlite); builder.Build().Run(); @@ -268,7 +268,7 @@ const builder = await createBuilder(); const sqlite = await builder.addSqlite("sqlite"); await sqlite.withSqliteWeb(); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(sqlite); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx b/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx index b3ce44da30..c8a1af4ea6 100644 --- a/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx @@ -105,7 +105,7 @@ var db = builder.AddSurrealServer("surreal") .AddNamespace("ns") .AddDatabase("db"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -124,7 +124,7 @@ const surreal = await builder.addSurrealServer("surreal"); const ns = await surreal.addNamespace("ns"); const db = await ns.addDatabase("db"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(db); await exampleProject.waitFor(db); @@ -193,7 +193,7 @@ var db = surreal .AddNamespace("ns") .AddDatabase("db"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -214,7 +214,7 @@ surreal = await surreal.withSurrealist(); const ns = await surreal.addNamespace("ns"); const db = await ns.addDatabase("db"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(db); await exampleProject.waitFor(db); @@ -269,7 +269,7 @@ var db = builder.AddSurrealServer("surreal") .AddNamespace("ns") .AddDatabase("db"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -290,7 +290,7 @@ surreal = await surreal.withDataBindMount("./data/surreal/data"); const ns = await surreal.addNamespace("ns"); const db = await ns.addDatabase("db"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(db); await exampleProject.waitFor(db); @@ -346,7 +346,7 @@ var db = builder.AddSurrealServer("surreal", password: password) .AddNamespace("ns") .AddDatabase("db"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -367,7 +367,7 @@ const surreal = await builder.addSurrealServer("surreal", { password }); const ns = await surreal.addNamespace("ns"); const db = await ns.addDatabase("db"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(db); await exampleProject.waitFor(db); @@ -424,7 +424,7 @@ var db = surreal .AddNamespace("ns") .AddDatabase("db"); -builder.AddProject() +builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(db) .WaitFor(db); @@ -445,7 +445,7 @@ surreal = await surreal.withLogLevel("Debug"); const ns = await surreal.addNamespace("ns"); const db = await ns.addDatabase("db"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(db); await exampleProject.waitFor(db); diff --git a/src/frontend/src/content/docs/integrations/devtools/dab/dab-host.mdx b/src/frontend/src/content/docs/integrations/devtools/dab/dab-host.mdx index 3ef83f86a5..8ea9f37512 100644 --- a/src/frontend/src/content/docs/integrations/devtools/dab/dab-host.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/dab/dab-host.mdx @@ -75,7 +75,7 @@ var database = builder.AddSqlServer("sql") var dab = builder.AddDataAPIBuilder("dab") .WithReference(database); -builder.AddProject("web") +builder.AddDotnetProject("web", "../Web/Web.csproj") .WithReference(dab); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx b/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx index c36ca447c5..2847846e60 100644 --- a/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx @@ -103,7 +103,7 @@ In the AppHost project, add a dev tunnel and configure it to expose specific res ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var web = builder.AddProject("web"); +var web = builder.AddDotnetProject("web", "../Web/Web.csproj"); var tunnel = builder.AddDevTunnel("my-tunnel") .WithReference(web); @@ -148,7 +148,7 @@ To allow anonymous, public access to the entire tunnel, chain a call to the ("web"); +var web = builder.AddDotnetProject("web", "../Web/Web.csproj"); var tunnel = builder.AddDevTunnel("public-api") .WithReference(web) @@ -194,7 +194,7 @@ To configure other options for the dev tunnel, provide the `DevTunnelOptions` to ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var web = builder.AddProject("web"); +var web = builder.AddDotnetProject("web", "../Web/Web.csproj"); var options = new DevTunnelOptions { @@ -247,7 +247,7 @@ To allow anonymous access to specific endpoints, use the appropriate ("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); var tunnel = builder.AddDevTunnel("mixed-access") .WithReference(api, "public", allowAnonymous: true) diff --git a/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-connect.mdx b/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-connect.mdx index 327034aed3..d092b849ae 100644 --- a/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-connect.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-connect.mdx @@ -264,7 +264,7 @@ var flagd = builder.AddFlagd("flagd") var ofrepEndpoint = flagd.GetEndpoint("ofrep"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WaitFor(flagd) .WithEnvironment("OFREP_ENDPOINT", ofrepEndpoint); @@ -285,7 +285,7 @@ await flagd.withBindFileSync('./flags/'); const ofrepEndpoint = await flagd.ofrepEndpoint(); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'api', '../ExampleProject/ExampleProject.csproj' ); diff --git a/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-host.mdx b/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-host.mdx index bf857e5749..0ef748de97 100644 --- a/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-host.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-host.mdx @@ -69,7 +69,7 @@ var builder = DistributedApplication.CreateBuilder(args); var flagd = builder.AddFlagd("flagd") .WithBindFileSync("./flags/"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(flagd); // After adding all resources, run the app... @@ -87,7 +87,7 @@ const builder = await createBuilder(); const flagd = await builder.addFlagd('flagd'); await flagd.withBindFileSync('./flags/'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'api', '../ExampleProject/ExampleProject.csproj' ); @@ -129,7 +129,7 @@ var flagd = builder.AddFlagd("flagd") fileSource: "./flags/", filename: "flagd.json"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(flagd); // After adding all resources, run the app... @@ -147,7 +147,7 @@ const builder = await createBuilder(); const flagd = await builder.addFlagd('flagd'); await flagd.withBindFileSync('./flags/', { filename: 'flagd.json' }); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'api', '../ExampleProject/ExampleProject.csproj' ); @@ -203,7 +203,7 @@ var flagd = builder.AddFlagd("flagd") .WithBindFileSync("./flags/") .WithLogLevel(Microsoft.Extensions.Logging.LogLevel.Debug); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(flagd); // After adding all resources, run the app... @@ -232,7 +232,7 @@ var flagd = builder.AddFlagd( ofrepPort: 8016) .WithBindFileSync("./flags/"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj") .WithReference(flagd); // After adding all resources, run the app... @@ -253,7 +253,7 @@ const flagd = await builder.addFlagd('flagd', { }); await flagd.withBindFileSync('./flags/'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'api', '../ExampleProject/ExampleProject.csproj' ); diff --git a/src/frontend/src/content/docs/integrations/devtools/goff/goff-host.mdx b/src/frontend/src/content/docs/integrations/devtools/goff/goff-host.mdx index fdd6f0f5fd..2aebdaf124 100644 --- a/src/frontend/src/content/docs/integrations/devtools/goff/goff-host.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/goff/goff-host.mdx @@ -61,7 +61,7 @@ var builder = DistributedApplication.CreateBuilder(args); var goff = builder.AddGoFeatureFlag("goff") .WithGoffBindMount("./goff"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(goff); // After adding all resources, run the app... @@ -79,7 +79,7 @@ const builder = await createBuilder(); const goff = await builder.addGoFeatureFlag('goff'); await goff.withGoffBindMount('./goff'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); @@ -118,7 +118,7 @@ var builder = DistributedApplication.CreateBuilder(args); var goff = builder.AddGoFeatureFlag("goff", pathToConfigFile: "/goff/goff-proxy.yaml") .WithGoffBindMount("./goff"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(goff); // After adding all resources, run the app... @@ -138,7 +138,7 @@ const goff = await builder.addGoFeatureFlag('goff', { }); await goff.withGoffBindMount('./goff'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); @@ -166,7 +166,7 @@ var goff = builder.AddGoFeatureFlag("goff") .WithGoffBindMount("./goff") .WithDataVolume(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(goff); // After adding all resources, run the app... @@ -185,7 +185,7 @@ const goff = await builder.addGoFeatureFlag('goff'); await goff.withGoffBindMount('./goff'); await goff.withDataVolume(); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); @@ -240,7 +240,7 @@ var goff = builder.AddGoFeatureFlag("goff") .WithGoffBindMount("./goff") .WithLogLevel(Microsoft.Extensions.Logging.LogLevel.Debug); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(goff); // After adding all resources, run the app... @@ -262,7 +262,7 @@ const goff = await builder.addGoFeatureFlag('goff'); await goff.withGoffBindMount('./goff'); await goff.withLogLevel(GoFeatureFlagLogLevel.Debug); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); @@ -289,7 +289,7 @@ var builder = DistributedApplication.CreateBuilder(args); var goff = builder.AddGoFeatureFlag(name: "goff", port: 11031) .WithGoffBindMount("./goff"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(goff); // After adding all resources, run the app... @@ -307,7 +307,7 @@ const builder = await createBuilder(); const goff = await builder.addGoFeatureFlag('goff', { port: 11031 }); await goff.withGoffBindMount('./goff'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); diff --git a/src/frontend/src/content/docs/integrations/devtools/mailpit/mailpit-host.mdx b/src/frontend/src/content/docs/integrations/devtools/mailpit/mailpit-host.mdx index 6ad8266abd..0a814a08e5 100644 --- a/src/frontend/src/content/docs/integrations/devtools/mailpit/mailpit-host.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/mailpit/mailpit-host.mdx @@ -67,7 +67,7 @@ var builder = DistributedApplication.CreateBuilder(args); var mailpit = builder.AddMailPit("mailpit"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mailpit); // After adding all resources, run the app... @@ -84,7 +84,7 @@ const builder = await createBuilder(); const mailpit = await builder.addMailPit('mailpit'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); @@ -134,7 +134,7 @@ var builder = DistributedApplication.CreateBuilder(args); var mailpit = builder.AddMailPit("mailpit") .WithDataVolume("mailpit-data"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(mailpit); // After adding all resources, run the app... @@ -152,7 +152,7 @@ const builder = await createBuilder(); const mailpit = await builder.addMailPit('mailpit'); await mailpit.withDataVolume('mailpit-data'); -const api = await builder.addProject( +const api = await builder.addDotnetProject( 'apiservice', '../ExampleProject/ExampleProject.csproj' ); diff --git a/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-get-started.mdx b/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-get-started.mdx index 52271c116e..0905c2f368 100644 --- a/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-get-started.mdx @@ -56,7 +56,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const mcpServer = await builder.addProject( +const mcpServer = await builder.addDotnetProject( 'mcp-server', '../McpServer/McpServer.csproj' ); @@ -73,7 +73,7 @@ await builder.build().run(); ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var mcpServer = builder.AddProject("mcp-server"); +var mcpServer = builder.AddDotnetProject("mcp-server", "../McpServer/McpServer.csproj"); var inspector = builder.AddMcpInspector("inspector") .WithMcpServer(mcpServer); diff --git a/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-host.mdx b/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-host.mdx index 16ed1f6a78..451d2bc7cb 100644 --- a/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-host.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/mcp-inspector/mcp-inspector-host.mdx @@ -44,7 +44,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const mcpServer = await builder.addProject( +const mcpServer = await builder.addDotnetProject( 'mcp-server', '../McpServer/McpServer.csproj' ); @@ -63,7 +63,7 @@ In TypeScript, the exported methods are named `addMcpInspector` and `withInspect ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var mcpServer = builder.AddProject("mcp-server"); +var mcpServer = builder.AddDotnetProject("mcp-server", "../McpServer/McpServer.csproj"); var inspector = builder.AddMcpInspector("inspector") .WithMcpServer(mcpServer); @@ -91,8 +91,8 @@ The default server must be registered before the Inspector starts. Register addi ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var primaryServer = builder.AddProject("primary-mcp-server"); -var secondaryServer = builder.AddProject("secondary-mcp-server"); +var primaryServer = builder.AddDotnetProject("primary-mcp-server", "../PrimaryMcpServer/PrimaryMcpServer.csproj"); +var secondaryServer = builder.AddDotnetProject("secondary-mcp-server", "../SecondaryMcpServer/SecondaryMcpServer.csproj"); var inspector = builder.AddMcpInspector("inspector") .WithMcpServer(primaryServer) @@ -107,7 +107,7 @@ If you use an endpoint path other than `/mcp`, set `path` to the route served by ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var mcpServer = builder.AddProject("mcp-server"); +var mcpServer = builder.AddDotnetProject("mcp-server", "../McpServer/McpServer.csproj"); var inspector = builder.AddMcpInspector("inspector") .WithMcpServer(mcpServer, path: "/api/mcp"); @@ -126,7 +126,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const mcpServer = await builder.addProject( +const mcpServer = await builder.addDotnetProject( 'mcp-server', '../McpServer/McpServer.csproj' ); @@ -146,7 +146,7 @@ In C#, configure `Aspire.Hosting.McpInspectorOptions` with an options object or ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var mcpServer = builder.AddProject("mcp-server"); +var mcpServer = builder.AddDotnetProject("mcp-server", "../McpServer/McpServer.csproj"); var inspector = builder.AddMcpInspector("inspector", options => { options.ClientPort = 6275; @@ -183,7 +183,7 @@ on the machine running the AppHost. ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var mcpServer = builder.AddProject("mcp-server"); +var mcpServer = builder.AddDotnetProject("mcp-server", "../McpServer/McpServer.csproj"); var inspector = builder.AddMcpInspector("inspector") .WithPnpm() .WithMcpServer(mcpServer); @@ -203,7 +203,7 @@ To supply a token from an AppHost parameter, set `ProxyToken`: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var mcpServer = builder.AddProject("mcp-server"); +var mcpServer = builder.AddDotnetProject("mcp-server", "../McpServer/McpServer.csproj"); var proxyToken = builder.AddParameter("mcp-inspector-token", secret: true); var inspector = builder.AddMcpInspector("inspector", options => diff --git a/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx b/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx index 841614aa0e..3b3fc04cbe 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx @@ -280,7 +280,7 @@ var builder = DistributedApplication.CreateBuilder(args); var postgres = builder.AddPostgres("postgres") .AddDatabase("appdb"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(postgres); var efMigrations = builder.AddDotnetTool("ef-migrate", "dotnet-ef") @@ -304,7 +304,7 @@ const builder = await createBuilder(); const postgres = await builder.addPostgres("postgres"); const appdb = await postgres.addDatabase("appdb"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(appdb); const efMigrations = await builder.addDotnetTool("ef-migrate", "dotnet-ef"); diff --git a/src/frontend/src/content/docs/integrations/dotnet/maui.mdx b/src/frontend/src/content/docs/integrations/dotnet/maui.mdx index ae40c6fb37..87803b5ecf 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/maui.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/maui.mdx @@ -70,7 +70,7 @@ To orchestrate a .NET MAUI application in your AppHost, call ("webapi"); +var weatherApi = builder.AddDotnetProject("webapi", "../WeatherApi/WeatherApi.csproj"); var mauiapp = builder.AddMauiProject("mauiapp", "../YourMauiApp/YourMauiApp.csproj"); @@ -149,7 +149,7 @@ The following example shows all platform configurations together in a single App ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var weatherApi = builder.AddProject("webapi"); +var weatherApi = builder.AddDotnetProject("webapi", "../WeatherApi/WeatherApi.csproj"); var publicDevTunnel = builder.AddDevTunnel("devtunnel-public") .WithAnonymousAccess() diff --git a/src/frontend/src/content/docs/integrations/frameworks/bun-apps.mdx b/src/frontend/src/content/docs/integrations/frameworks/bun-apps.mdx index dbceb3d2f1..2539d33218 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/bun-apps.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/bun-apps.mdx @@ -92,7 +92,7 @@ var builder = DistributedApplication.CreateBuilder(args); var bunApp = builder.AddBunApp("bun-api", "../bun-app", "server.ts") .WithHttpEndpoint(port: 3000, env: "PORT"); -builder.AddProject("apiservice") +builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(bunApp); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/frameworks/dapr/dapr-host.mdx b/src/frontend/src/content/docs/integrations/frameworks/dapr/dapr-host.mdx index 34891b90bc..1c0e04512c 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/dapr/dapr-host.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/dapr/dapr-host.mdx @@ -78,7 +78,7 @@ builder.AddDapr(); var stateStore = builder.AddDaprStateStore("statestore"); var pubSub = builder.AddDaprPubSub("pubsub"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithDaprSidecar(sidecar => sidecar .WithReference(stateStore) .WithReference(pubSub)); @@ -161,7 +161,7 @@ using CommunityToolkit.Aspire.Hosting.Dapr; var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithDaprSidecar(new DaprSidecarOptions { AppId = "catalog-api", diff --git a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-get-started.mdx b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-get-started.mdx index f7c50797bb..e4b2047593 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-get-started.mdx @@ -32,7 +32,7 @@ Adding C# apps by path through `Aspire.Hosting.Dotnet` gives you: - **Path-based orchestration for C#.** Model a C# project or a file-based `.cs` app in the AppHost the same way you'd model a Go, Python, or JavaScript app added by path, without adding the project to the AppHost's solution. - **File-based app support.** Add a single `.cs` file-based app (requires .NET 10 or later) directly, matching the file-based apps experience for `dotnet run --file`. -- **Familiar launch and configuration behavior.** Endpoints, environment variables, and service discovery are configured from the project's `launchSettings.json` and Kestrel configuration, matching . +- **Familiar launch and configuration behavior.** Endpoints, environment variables, and service discovery are configured from the project's `launchSettings.json` and Kestrel configuration. ## How the pieces fit together diff --git a/src/frontend/src/content/docs/integrations/frameworks/orleans.mdx b/src/frontend/src/content/docs/integrations/frameworks/orleans.mdx index 7081eafb2e..24a6953aec 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/orleans.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/orleans.mdx @@ -248,7 +248,7 @@ var orleans = builder.AddOrleans("default") .WithClustering(clusteringTable) .WithGrainStorage("Default", grainStorage); -var server = builder.AddProject("orleans-server") +var server = builder.AddDotnetProject("orleans-server", "../OrleansServer/OrleansServer.csproj") .WithReference(orleans); // After adding all resources, run the app... @@ -271,7 +271,7 @@ const orleans = await builder.addOrleans("default") .withClustering(clusteringTable) .withGrainStorage("Default", grainStorage); -const server = await builder.addProject("orleans-server", "../OrleansServer/OrleansServer.csproj") +const server = await builder.addDotnetProject("orleans-server", "../OrleansServer/OrleansServer.csproj") .withOrleansReference(orleans); await builder.build().run(); @@ -329,7 +329,7 @@ var orleans = builder.AddOrleans("default") .WithClustering(clusteringTable) .WithGrainStorage("Default", grainStorage); -var client = builder.AddProject("orleans-client") +var client = builder.AddDotnetProject("orleans-client", "../OrleansClient/OrleansClient.csproj") .WithReference(orleans.AsClient()); // After adding all resources, run the app... @@ -352,7 +352,7 @@ const orleans = await builder.addOrleans("default") .withClustering(clusteringTable) .withGrainStorage("Default", grainStorage); -const client = await builder.addProject("orleans-client", "../OrleansClient/OrleansClient.csproj") +const client = await builder.addDotnetProject("orleans-client", "../OrleansClient/OrleansClient.csproj") .withOrleansClientReference(orleans.asClient()); await builder.build().run(); diff --git a/src/frontend/src/content/docs/integrations/frameworks/python.mdx b/src/frontend/src/content/docs/integrations/frameworks/python.mdx index 1684867041..9d261b3fbc 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/python.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/python.mdx @@ -53,7 +53,7 @@ var python = builder.AddPythonApp( scriptPath: "main.py") .WithHttpEndpoint(port: 8000, env: "PORT"); -builder.AddProject("example") +builder.AddDotnetProject("example", "../ExampleProject/ExampleProject.csproj") .WithReference(python); builder.Build().Run(); @@ -74,7 +74,7 @@ const python = await builder.addPythonApp( ); await python.withHttpEndpoint({ port: 8000, env: 'PORT' }); -const example = await builder.addProject( +const example = await builder.addDotnetProject( 'example', '../ExampleProject/ExampleProject.csproj' ); @@ -199,7 +199,7 @@ var python = builder.AddUvicornApp( app: "main:app") .WithHttpEndpoint(port: 8000, env: "PORT"); -builder.AddProject("example") +builder.AddDotnetProject("example", "../ExampleProject/ExampleProject.csproj") .WithReference(python); builder.Build().Run(); @@ -220,7 +220,7 @@ const python = await builder.addUvicornApp( ); await python.withHttpEndpoint({ port: 8000, env: 'PORT' }); -const example = await builder.addProject( +const example = await builder.addDotnetProject( 'example', '../ExampleProject/ExampleProject.csproj' ); @@ -701,7 +701,7 @@ var publicApi = builder.AddUvicornApp("public-api", "../public-api", "main:app") .WithExternalHttpEndpoints(); // publicApi IS exposed publicly -builder.AddProject("frontend") +builder.AddDotnetProject("frontend", "../WebFrontend/WebFrontend.csproj") .WithReference(internalApi) .WithReference(publicApi); @@ -733,7 +733,7 @@ await publicApi.withHttpEndpoint({ port: 8000, env: 'PORT' }); await publicApi.withExternalHttpEndpoints(); // publicApi IS exposed publicly -const frontend = await builder.addProject( +const frontend = await builder.addDotnetProject( 'frontend', '../WebFrontend/WebFrontend.csproj' ); diff --git a/src/frontend/src/content/docs/integrations/messaging/activemq/activemq-host.mdx b/src/frontend/src/content/docs/integrations/messaging/activemq/activemq-host.mdx index 8d4ee6e271..2dd10d2265 100644 --- a/src/frontend/src/content/docs/integrations/messaging/activemq/activemq-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/activemq/activemq-host.mdx @@ -50,7 +50,7 @@ const broker = await builder.addActiveMQ('activemq', { userName: username, password, }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(broker); await builder.build().run(); @@ -65,7 +65,7 @@ var username = builder.AddParameter("activemq-user", "admin"); var password = builder.AddParameter("activemq-password", secret: true); var broker = builder.AddActiveMQ("activemq", username, password); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(broker); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx b/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx index 94be9a331e..eaed6d97dc 100644 --- a/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx @@ -104,7 +104,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kafka = builder.AddKafka("kafka"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kafka); // After adding all resources, run the app... @@ -162,7 +162,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kafka = builder.AddKafka("kafka") .WithKafkaUI(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kafka); // After adding all resources, run the app... @@ -212,7 +212,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kafka = builder.AddKafka("kafka") .WithKafkaUI(kafkaUI => kafkaUI.WithHostPort(9100)); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kafka); // After adding all resources, run the app... @@ -264,7 +264,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kafka = builder.AddKafka("kafka") .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kafka); // After adding all resources, run the app... @@ -314,7 +314,7 @@ var kafka = builder.AddKafka("kafka") source: "/Kafka/Data", isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kafka); // After adding all resources, run the app... @@ -455,7 +455,7 @@ var builder = DistributedApplication.CreateBuilder(args); var kafka = builder.AddConnectionString("kafka"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(kafka); // After adding all resources, run the app... @@ -469,7 +469,7 @@ const builder = await createBuilder(); const kafka = await builder.addConnectionString("kafka"); -const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj"); +const exampleProject = await builder.addDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj"); await exampleProject.withReference(kafka); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-connect.mdx b/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-connect.mdx index fbe170e78b..a395afb33d 100644 --- a/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-connect.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-connect.mdx @@ -49,7 +49,7 @@ var builder = DistributedApplication.CreateBuilder(args); var lavinmq = builder.AddConnectionString("lavinmq"); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(lavinmq); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-host.mdx b/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-host.mdx index 1b38a1052d..761f274e88 100644 --- a/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/lavinmq/lavinmq-host.mdx @@ -69,7 +69,7 @@ var builder = DistributedApplication.CreateBuilder(args); var lavinmq = builder.AddLavinMQ("lavinmq"); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(lavinmq); builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/messaging/listmonk/listmonk-host.mdx b/src/frontend/src/content/docs/integrations/messaging/listmonk/listmonk-host.mdx index 5ea9c307fe..72462604c5 100644 --- a/src/frontend/src/content/docs/integrations/messaging/listmonk/listmonk-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/listmonk/listmonk-host.mdx @@ -36,7 +36,7 @@ await listmonk.withReference(database); await listmonk.withAdminCredentials('admin', password); await listmonk.withUploadsVolume(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(listmonk); await builder.build().run(); @@ -56,7 +56,7 @@ var listmonk = builder.AddListmonk("listmonk") .WithAdminCredentials("admin", adminPassword) .WithUploadsVolume(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(listmonk); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-get-started.mdx b/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-get-started.mdx index 3af3ce2d96..7b8ce53c64 100644 --- a/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-get-started.mdx @@ -32,7 +32,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const mqtt = await builder.addMosquitto('mqtt'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(mqtt); await api.waitFor(mqtt); @@ -46,7 +46,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var mqtt = builder.AddMosquitto("mqtt"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(mqtt) .WaitFor(mqtt); diff --git a/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-host.mdx b/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-host.mdx index 9a133f16dc..fb4a794a75 100644 --- a/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/mosquitto/mosquitto-host.mdx @@ -25,7 +25,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const mqtt = await builder.addMosquitto('mqtt'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(mqtt); await api.waitFor(mqtt); @@ -39,7 +39,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var mqtt = builder.AddMosquitto("mqtt"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(mqtt) .WaitFor(mqtt); diff --git a/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx b/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx index 7b444a5029..55faff48f7 100644 --- a/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx @@ -105,7 +105,7 @@ var builder = DistributedApplication.CreateBuilder(args); var nats = builder.AddNats("nats"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(nats); // After adding all resources, run the app... @@ -165,7 +165,7 @@ var builder = DistributedApplication.CreateBuilder(args); var nats = builder.AddNats("nats") .WithJetStream(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(nats); // After adding all resources, run the app... @@ -212,7 +212,7 @@ var nats = builder.AddNats("nats") .WithJetStream() .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(nats); // After adding all resources, run the app... @@ -265,7 +265,7 @@ var nats = builder.AddNats("nats") source: @"C:\Nats\Data", isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(nats); // After adding all resources, run the app... @@ -321,7 +321,7 @@ var password = builder.AddParameter("natsPass", secret: true); var nats = builder.AddNats("nats", userName: userName, password: password); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(nats); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-get-started.mdx b/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-get-started.mdx index 510350a734..025d45da7a 100644 --- a/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-get-started.mdx @@ -43,7 +43,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const papercut = await builder.addPapercutSmtp('papercut'); -const mailer = await builder.addProject('mailer', '../Mailer/Mailer.csproj'); +const mailer = await builder.addDotnetProject('mailer', '../Mailer/Mailer.csproj'); await mailer.withReference(papercut); await mailer.waitFor(papercut); @@ -57,7 +57,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var papercut = builder.AddPapercutSmtp("papercut"); -builder.AddProject("mailer") +builder.AddDotnetProject("mailer", "../Mailer/Mailer.csproj") .WithReference(papercut) .WaitFor(papercut); diff --git a/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-host.mdx b/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-host.mdx index 174b379d68..4c752f92d3 100644 --- a/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/papercut-smtp/papercut-smtp-host.mdx @@ -41,7 +41,7 @@ const papercut = await builder.addPapercutSmtp('papercut', { smtpPort: 2525, }); -const mailer = await builder.addProject('mailer', '../Mailer/Mailer.csproj'); +const mailer = await builder.addDotnetProject('mailer', '../Mailer/Mailer.csproj'); await mailer.withReference(papercut); await mailer.waitFor(papercut); @@ -55,7 +55,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var papercut = builder.AddPapercutSmtp("papercut", httpPort: 8080, smtpPort: 2525); -builder.AddProject("mailer") +builder.AddDotnetProject("mailer", "../Mailer/Mailer.csproj") .WithReference(papercut) .WaitFor(papercut); diff --git a/src/frontend/src/content/docs/integrations/messaging/posta/posta-get-started.mdx b/src/frontend/src/content/docs/integrations/messaging/posta/posta-get-started.mdx index f012b97122..fad089ad9d 100644 --- a/src/frontend/src/content/docs/integrations/messaging/posta/posta-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/posta/posta-get-started.mdx @@ -34,7 +34,7 @@ const database = await postgres.addDatabase('posta-db', 'posta'); const redis = await builder.addRedis('redis'); const posta = await builder.addPostaWithReferences('posta', database, redis); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(posta); await builder.build().run(); @@ -54,7 +54,7 @@ var database = postgres.AddDatabase("posta-db", "posta"); var redis = builder.AddRedis("redis"); var posta = builder.AddPosta("posta", database, redis); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(posta); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/posta/posta-host.mdx b/src/frontend/src/content/docs/integrations/messaging/posta/posta-host.mdx index ec2f62569e..1b98ba1205 100644 --- a/src/frontend/src/content/docs/integrations/messaging/posta/posta-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/posta/posta-host.mdx @@ -32,7 +32,7 @@ const redis = await builder.addRedis('redis'); const posta = await builder.addPostaWithReferences('posta', database, redis); await posta.withDataVolume(); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(posta); await builder.build().run(); @@ -50,7 +50,7 @@ var redis = builder.AddRedis("redis"); var posta = builder.AddPosta("posta", database, redis) .WithDataVolume(); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(posta); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx b/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx index a33bce38b1..4e6e7fcd50 100644 --- a/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx @@ -109,7 +109,7 @@ var builder = DistributedApplication.CreateBuilder(args); var rabbitmq = builder.AddRabbitMQ("messaging"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(rabbitmq); // After adding all resources, run the app... @@ -169,7 +169,7 @@ var builder = DistributedApplication.CreateBuilder(args); var rabbitmq = builder.AddRabbitMQ("messaging") .WithDataVolume(isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(rabbitmq); // After adding all resources, run the app... @@ -219,7 +219,7 @@ var rabbitmq = builder.AddRabbitMQ("messaging") source: "/RabbitMQ/Data", isReadOnly: false); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(rabbitmq); // After adding all resources, run the app... @@ -273,7 +273,7 @@ var password = builder.AddParameter("password", secret: true); var rabbitmq = builder.AddRabbitMQ("messaging", username, password); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(rabbitmq); // After adding all resources, run the app... @@ -329,7 +329,7 @@ var password = builder.AddParameter("password", secret: true); var rabbitmq = builder.AddRabbitMQ("messaging", username, password) .WithManagementPlugin(); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(rabbitmq); // After adding all resources, run the app... @@ -464,7 +464,7 @@ var builder = DistributedApplication.CreateBuilder(args); var rabbitmq = builder.AddConnectionString("messaging"); -var exampleProject = builder.AddProject("apiservice") +var exampleProject = builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") .WithReference(rabbitmq); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-get-started.mdx b/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-get-started.mdx index 225f7ef93e..2271aa0f88 100644 --- a/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-get-started.mdx @@ -32,7 +32,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const redpanda = await builder.addRedPanda('redpanda'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(redpanda); await api.waitFor(redpanda); @@ -46,7 +46,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var redpanda = builder.AddRedPanda("redpanda"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(redpanda) .WaitFor(redpanda); diff --git a/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-host.mdx b/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-host.mdx index 74200420d9..e885bd074a 100644 --- a/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/redpanda/redpanda-host.mdx @@ -25,7 +25,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const redpanda = await builder.addRedPanda('redpanda'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withReference(redpanda); await api.waitFor(redpanda); @@ -39,7 +39,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var redpanda = builder.AddRedPanda("redpanda"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(redpanda) .WaitFor(redpanda); diff --git a/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-get-started.mdx b/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-get-started.mdx index 56e8a24cf0..49f6fb0654 100644 --- a/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-get-started.mdx @@ -38,7 +38,7 @@ const builder = await createBuilder(); const sftp = await builder.addSftp('sftp'); await sftp.withUsersFile('./users.conf'); -const worker = await builder.addProject('worker', '../Worker/Worker.csproj'); +const worker = await builder.addDotnetProject('worker', '../Worker/Worker.csproj'); await worker.withReference(sftp); await builder.build().run(); @@ -56,7 +56,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sftp = builder.AddSftp("sftp") .WithUsersFile("users.conf"); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(sftp); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-host.mdx b/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-host.mdx index 3ef690c469..ce3f280d99 100644 --- a/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/sftp/sftp-host.mdx @@ -34,7 +34,7 @@ const builder = await createBuilder(); const sftp = await builder.addSftp('sftp'); await sftp.withUsersFile('./users.conf'); -const worker = await builder.addProject('worker', '../Worker/Worker.csproj'); +const worker = await builder.addDotnetProject('worker', '../Worker/Worker.csproj'); await worker.withReference(sftp); await builder.build().run(); @@ -48,7 +48,7 @@ var builder = DistributedApplication.CreateBuilder(args); var sftp = builder.AddSftp("sftp") .WithUsersFile("users.conf"); -builder.AddProject("worker") +builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(sftp); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-get-started.mdx b/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-get-started.mdx index 6bf43caed9..4742d909b8 100644 --- a/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-get-started.mdx @@ -70,7 +70,7 @@ const builder = await createBuilder(); const collector = await builder.addOpenTelemetryCollector('otel-collector'); await collector.withConfig('./otel-collector-config.yaml'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withOpenTelemetryCollectorRouting(collector); // After adding all resources, run the app... @@ -86,7 +86,7 @@ var builder = DistributedApplication.CreateBuilder(args); var collector = builder.AddOpenTelemetryCollector("otel-collector") .WithConfig("./otel-collector-config.yaml"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithOpenTelemetryCollectorRouting(collector); // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-host.mdx b/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-host.mdx index 24641aebcc..0740420406 100644 --- a/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-host.mdx +++ b/src/frontend/src/content/docs/integrations/observability/opentelemetry-collector/opentelemetry-collector-host.mdx @@ -31,7 +31,7 @@ const builder = await createBuilder(); const collector = await builder.addOpenTelemetryCollector('otel-collector'); await collector.withConfig('./otel-collector-config.yaml'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withOpenTelemetryCollectorRouting(collector); // After adding all resources, run the app... @@ -47,7 +47,7 @@ var builder = DistributedApplication.CreateBuilder(args); var collector = builder.AddOpenTelemetryCollector("otel-collector") .WithConfig("./otel-collector-config.yaml"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithOpenTelemetryCollectorRouting(collector); // After adding all resources, run the app... @@ -82,7 +82,7 @@ const collector = await builder.addOpenTelemetryCollector('otel-collector'); await collector.withConfig('./otel-collector-config.yaml'); await collector.withAppForwarding(); -await builder.addProject('api', '../Api/Api.csproj'); +await builder.addDotnetProject('api', '../Api/Api.csproj'); // After adding all resources, run the app... await builder.build().run(); @@ -98,7 +98,7 @@ var collector = builder.AddOpenTelemetryCollector("otel-collector") .WithConfig("./otel-collector-config.yaml") .WithAppForwarding(); -builder.AddProject("api"); +builder.AddDotnetProject("api", "../Api/Api.csproj"); // After adding all resources, run the app... builder.Build().Run(); diff --git a/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx b/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx index b34c592cc6..a099e675f2 100644 --- a/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx +++ b/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx @@ -107,7 +107,7 @@ var seq = builder.AddSeq("seq") .WithLifetime(ContainerLifetime.Persistent) .WithEnvironment("ACCEPT_EULA", "Y"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(seq) .WaitFor(seq); @@ -187,7 +187,7 @@ var seq = builder.AddSeq("seq") .WithLifetime(ContainerLifetime.Persistent) .WithEnvironment("ACCEPT_EULA", "Y"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(seq) .WaitFor(seq); @@ -208,7 +208,7 @@ await seq.excludeFromManifest(); await seq.withLifetime(ContainerLifetime.Persistent); await seq.withEnvironment("ACCEPT_EULA", "Y"); -const myService = await builder.addProject("example", "../ExampleProject/ExampleProject.csproj"); +const myService = await builder.addDotnetProject("example", "../ExampleProject/ExampleProject.csproj"); await myService .withReference(seq) .waitFor(seq); @@ -254,7 +254,7 @@ var seq = builder.AddSeq("seq") .WithLifetime(ContainerLifetime.Persistent) .WithEnvironment("ACCEPT_EULA", "Y"); -var myService = builder.AddProject() +var myService = builder.AddDotnetProject("exampleproject", "../ExampleProject/ExampleProject.csproj") .WithReference(seq) .WaitFor(seq); diff --git a/src/frontend/src/content/docs/integrations/overview.mdx b/src/frontend/src/content/docs/integrations/overview.mdx index f191b6de11..d2641f1d63 100644 --- a/src/frontend/src/content/docs/integrations/overview.mdx +++ b/src/frontend/src/content/docs/integrations/overview.mdx @@ -59,7 +59,7 @@ var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); var db = builder.AddPostgres("postgres").AddDatabase("appdb"); -builder.AddProject("api") +builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(cache) .WithReference(db); @@ -97,7 +97,7 @@ const builder = await createBuilder(); const cache = await builder.addRedis("cache"); const db = (await builder.addPostgres("postgres")).addDatabase("appdb"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.withReference(cache); await api.withReference(db); diff --git a/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-get-started.mdx b/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-get-started.mdx index 4847a866f9..0bf295092c 100644 --- a/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-get-started.mdx @@ -75,7 +75,7 @@ const builder = await createBuilder(); const authToken = await builder.addParameter('ngrok-auth-token', { secret: true, }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); const ngrok = await builder.addNgrok('ngrok'); await ngrok.withAuthToken(authToken); @@ -91,7 +91,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var authToken = builder.AddParameter("ngrok-auth-token", secret: true); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); builder.AddNgrok("ngrok") .WithAuthToken(authToken) diff --git a/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-host.mdx b/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-host.mdx index ba421cc4c5..41c2464357 100644 --- a/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-host.mdx +++ b/src/frontend/src/content/docs/integrations/reverse-proxies/ngrok/ngrok-host.mdx @@ -48,7 +48,7 @@ const builder = await createBuilder(); const authToken = await builder.addParameter('ngrok-auth-token', { secret: true, }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); const ngrok = await builder.addNgrok('ngrok', { endpointPort: 59600, @@ -70,7 +70,7 @@ await builder.build().run(); var builder = DistributedApplication.CreateBuilder(args); var authToken = builder.AddParameter("ngrok-auth-token", secret: true); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); builder.AddNgrok("ngrok", endpointPort: 59600, configurationVersion: 3) .WithAuthToken(authToken) diff --git a/src/frontend/src/content/docs/integrations/reverse-proxies/yarp.mdx b/src/frontend/src/content/docs/integrations/reverse-proxies/yarp.mdx index 148152ff7d..05122c4ed8 100644 --- a/src/frontend/src/content/docs/integrations/reverse-proxies/yarp.mdx +++ b/src/frontend/src/content/docs/integrations/reverse-proxies/yarp.mdx @@ -72,8 +72,8 @@ In your AppHost, add a YARP resource and configure routes programmatically: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var catalogService = builder.AddProject("catalogservice"); -var basketService = builder.AddProject("basketservice"); +var catalogService = builder.AddDotnetProject("catalogservice", "../CatalogService/CatalogService.csproj"); +var basketService = builder.AddDotnetProject("basketservice", "../BasketService/BasketService.csproj"); var gateway = builder.AddYarp("gateway") .WithConfiguration(yarp => @@ -93,11 +93,11 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const catalogService = await builder.addProject( +const catalogService = await builder.addDotnetProject( 'catalogservice', '../CatalogService/CatalogService.csproj' ); -const basketService = await builder.addProject( +const basketService = await builder.addDotnetProject( 'basketservice', '../BasketService/BasketService.csproj' ); @@ -135,8 +135,8 @@ The YARP integration provides a fluent API for configuring routes, clusters, and ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var catalogService = builder.AddProject("catalogservice"); -var basketService = builder.AddProject("basketservice"); +var catalogService = builder.AddDotnetProject("catalogservice", "../CatalogService/CatalogService.csproj"); +var basketService = builder.AddDotnetProject("basketservice", "../BasketService/BasketService.csproj"); var gateway = builder.AddYarp("gateway") .WithConfiguration(yarp => @@ -165,11 +165,11 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const catalogService = await builder.addProject( +const catalogService = await builder.addDotnetProject( 'catalogservice', '../CatalogService/CatalogService.csproj' ); -const basketService = await builder.addProject( +const basketService = await builder.addDotnetProject( 'basketservice', '../BasketService/BasketService.csproj' ); @@ -317,7 +317,7 @@ The YARP integration automatically works with service discovery when targeting r ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var catalogService = builder.AddProject("catalogservice"); +var catalogService = builder.AddDotnetProject("catalogservice", "../CatalogService/CatalogService.csproj"); var gateway = builder.AddYarp("gateway") .WithConfiguration(yarp => @@ -337,7 +337,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const catalogService = await builder.addProject( +const catalogService = await builder.addDotnetProject( 'catalogservice', '../CatalogService/CatalogService.csproj' ); @@ -474,7 +474,7 @@ You can combine static file serving with dynamic routing: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var apiService = builder.AddProject("api"); +var apiService = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"); var gateway = builder.AddYarp("gateway") .WithStaticFiles("../webapp/dist") @@ -496,7 +496,7 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const apiService = await builder.addProject( +const apiService = await builder.addDotnetProject( 'api', '../ApiService/ApiService.csproj' ); @@ -526,7 +526,7 @@ When both the YARP gateway and backend services use HTTPS, configure HTTPS endpo var builder = DistributedApplication.CreateBuilder(args); // Backend service with HTTPS -var razorPages = builder.AddProject("razorpages") +var razorPages = builder.AddDotnetProject("razorpages", "../RazorPagesApp/RazorPagesApp.csproj") .WithHttpsEndpoint(); // YARP gateway proxying to the HTTPS backend @@ -551,7 +551,7 @@ const builder = await createBuilder(); // Backend service with HTTPS const razorPages = await builder - .addProject('razorpages', '../RazorPagesApp/RazorPagesApp.csproj') + .addDotnetProject('razorpages', '../RazorPagesApp/RazorPagesApp.csproj') .withHttpsEndpoint(); // YARP gateway proxying to the HTTPS backend diff --git a/src/frontend/src/content/docs/integrations/security/bitwarden-secret-manager/bitwarden-secret-manager-host.mdx b/src/frontend/src/content/docs/integrations/security/bitwarden-secret-manager/bitwarden-secret-manager-host.mdx index 3c1552fdf4..dac5db7215 100644 --- a/src/frontend/src/content/docs/integrations/security/bitwarden-secret-manager/bitwarden-secret-manager-host.mdx +++ b/src/frontend/src/content/docs/integrations/security/bitwarden-secret-manager/bitwarden-secret-manager-host.mdx @@ -44,7 +44,7 @@ const bitwarden = await builder.addBitwardenSecretManager( ); const apiKey = await bitwarden.addSecret('api-key'); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withBitwardenSecretManagerReference(bitwarden); await api.waitForCompletion(bitwarden); @@ -68,7 +68,7 @@ var bitwarden = builder.AddBitwardenSecretManager( accessToken); var apiKey = bitwarden.AddSecret("api-key"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(bitwarden) .WaitForCompletion(bitwarden); @@ -170,7 +170,7 @@ Use the secret resource directly with `WithEnvironment` to inject its resolved v ```typescript title="apphost.mts" -const worker = await builder.addProject('worker', '../Worker/Worker.csproj'); +const worker = await builder.addDotnetProject('worker', '../Worker/Worker.csproj'); await worker.withBitwardenSecretManagerReference(bitwarden); await worker.waitForCompletion(bitwarden); await worker.withEnvironment('SERVICE_TOKEN', serviceToken); @@ -180,7 +180,7 @@ await worker.withEnvironment('SERVICE_TOKEN', serviceToken); ```csharp title="AppHost.cs" -var worker = builder.AddProject("worker") +var worker = builder.AddDotnetProject("worker", "../Worker/Worker.csproj") .WithReference(bitwarden) .WaitForCompletion(bitwarden) .WithEnvironment("SERVICE_TOKEN", serviceToken); @@ -197,7 +197,7 @@ To retrieve the secret at runtime through the SDK, inject the identifier instead ```typescript title="apphost.mts" -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withBitwardenSecretManagerReference(bitwarden); await api.waitForCompletion(bitwarden); await api.withEnvironment( @@ -210,7 +210,7 @@ await api.withEnvironment( ```csharp title="AppHost.cs" -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(bitwarden) .WaitForCompletion(bitwarden) .WithEnvironment("SERVICE_TOKEN_SECRET_ID", serviceToken.AsSecretId()); @@ -238,7 +238,7 @@ const readOnlyToken = await builder.addParameter('bitwarden-readonly-token', { secret: true, }); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withBitwardenSecretManagerReference(bitwarden); await api.withBitwardenReferenceAccessToken(bitwarden, readOnlyToken); ``` @@ -249,7 +249,7 @@ await api.withBitwardenReferenceAccessToken(bitwarden, readOnlyToken); ```csharp title="AppHost.cs" var readOnlyToken = builder.AddParameter("bitwarden-readonly-token", secret: true); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(bitwarden) .WithBitwardenAccessToken(bitwarden, readOnlyToken); @@ -263,7 +263,7 @@ var api = builder.AddProject("api") The runtime client authenticates with Bitwarden when it starts. Frequent restarts without a persistent auth cache can trigger Bitwarden rate limits. -For a container resource, mount a named volume with `WithBitwardenAuthCacheVolume`. The default mount directory is `/var/lib/bitwarden`; the default volume name includes the app and Bitwarden resource names. This API requires a container and throws for process resources such as `AddProject`. +For a container resource, mount a named volume with `WithBitwardenAuthCacheVolume`. The default mount directory is `/var/lib/bitwarden`; the default volume name includes the app and Bitwarden resource names. This API requires a container and throws for process resources such as `AddDotnetProject`. @@ -298,7 +298,7 @@ const authCacheDirectory = await builder.addParameter( 'bitwarden-auth-cache-directory' ); -const api = await builder.addProject('api', '../Api/Api.csproj'); +const api = await builder.addDotnetProject('api', '../Api/Api.csproj'); await api.withBitwardenSecretManagerReference(bitwarden); await api.withBitwardenReferenceAuthCacheDirectoryFromParameter( bitwarden, @@ -312,7 +312,7 @@ await api.withBitwardenReferenceAuthCacheDirectoryFromParameter( ```csharp title="AppHost.cs" var authCacheDirectory = builder.AddParameter("bitwarden-auth-cache-directory"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithReference(bitwarden) .WithBitwardenAuthCacheDirectory(bitwarden, authCacheDirectory); diff --git a/src/frontend/src/content/docs/integrations/security/keycloak.mdx b/src/frontend/src/content/docs/integrations/security/keycloak.mdx index e6e4cf263c..50b870759c 100644 --- a/src/frontend/src/content/docs/integrations/security/keycloak.mdx +++ b/src/frontend/src/content/docs/integrations/security/keycloak.mdx @@ -52,11 +52,11 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); -var webfrontend = builder.AddProject("webfrontend") +var webfrontend = builder.AddDotnetProject("webfrontend", "../Web/Web.csproj") .WithExternalHttpEndpoints() .WithReference(keycloak) .WithReference(apiService) @@ -73,11 +73,11 @@ const builder = await createBuilder(); const keycloak = await builder.addKeycloak("keycloak", { port: 8080 }); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); -const webfrontend = await builder.addProject("webfrontend", "../Web/Web.csproj"); +const webfrontend = await builder.addDotnetProject("webfrontend", "../Web/Web.csproj"); await webfrontend.withExternalHttpEndpoints(); await webfrontend.withReference(keycloak); await webfrontend.withReference(apiService); @@ -128,7 +128,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080) .WithDataVolume(); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); @@ -144,7 +144,7 @@ const builder = await createBuilder(); const keycloak = await builder.addKeycloak("keycloak", { port: 8080 }); await keycloak.withDataVolume(); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); @@ -172,7 +172,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080) .WithDataBindMount(@"C:\Keycloak\Data"); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); @@ -188,7 +188,7 @@ const builder = await createBuilder(); const keycloak = await builder.addKeycloak("keycloak", { port: 8080 }); await keycloak.withDataBindMount("/path/to/keycloak/data"); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); @@ -217,7 +217,7 @@ var password = builder.AddParameter("password", secret: true); var keycloak = builder.AddKeycloak("keycloak", 8080, username, password); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); @@ -239,7 +239,7 @@ const keycloak = await builder.addKeycloak("keycloak", { adminPassword: password, }); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); @@ -262,7 +262,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080) .WithRealmImport("./Realms"); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); @@ -278,7 +278,7 @@ const builder = await createBuilder(); const keycloak = await builder.addKeycloak("keycloak", { port: 8080 }); await keycloak.withRealmImport("./Realms"); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); @@ -322,7 +322,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080) .WithDockerfile("./keycloak"); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); @@ -338,7 +338,7 @@ const builder = await createBuilder(); const keycloak = await builder.addKeycloak("keycloak", { port: 8080 }); await keycloak.withDockerfile("./keycloak"); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); @@ -400,7 +400,7 @@ var builder = DistributedApplication.CreateBuilder(args); var keycloak = builder.AddKeycloak("keycloak", 8080) .WithOtlpExporter(); -var apiService = builder.AddProject("apiservice") +var apiService = builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") .WithReference(keycloak) .WaitFor(keycloak); @@ -416,7 +416,7 @@ const builder = await createBuilder(); const keycloak = await builder.addKeycloak("keycloak", { port: 8080 }); await keycloak.withOtlpExporter(); -const apiService = await builder.addProject("apiservice", "../ApiService/ApiService.csproj"); +const apiService = await builder.addDotnetProject("apiservice", "../ApiService/ApiService.csproj"); await apiService.withReference(keycloak); await apiService.waitFor(keycloak); diff --git a/src/frontend/src/content/docs/integrations/security/logto/logto-get-started.mdx b/src/frontend/src/content/docs/integrations/security/logto/logto-get-started.mdx index f74708d8c9..f302f330e6 100644 --- a/src/frontend/src/content/docs/integrations/security/logto/logto-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/security/logto/logto-get-started.mdx @@ -73,7 +73,7 @@ The hosting package depends on the PostgreSQL and Redis hosting integrations. It const logto = await builder.addLogto('logto', postgres); await logto.withDatabaseSeeding(); - const web = await builder.addProject('web', '../Web/Web.csproj'); + const web = await builder.addDotnetProject('web', '../Web/Web.csproj'); await web.withReference(logto); await web.waitFor(logto); @@ -91,7 +91,7 @@ The hosting package depends on the PostgreSQL and Redis hosting integrations. It var logto = builder.AddLogto("logto", postgres) .WithDatabaseSeeding(); - builder.AddProject("web") + builder.AddDotnetProject("web", "../Web/Web.csproj") .WithReference(logto) .WaitFor(logto); diff --git a/src/frontend/src/content/docs/integrations/security/logto/logto-host.mdx b/src/frontend/src/content/docs/integrations/security/logto/logto-host.mdx index 7ab47b67fd..edb376f21b 100644 --- a/src/frontend/src/content/docs/integrations/security/logto/logto-host.mdx +++ b/src/frontend/src/content/docs/integrations/security/logto/logto-host.mdx @@ -40,7 +40,7 @@ const logto = await builder.addLogto('logto', postgres, { }); await logto.withDatabaseSeeding(); -const web = await builder.addProject('web', '../Web/Web.csproj'); +const web = await builder.addDotnetProject('web', '../Web/Web.csproj'); await web.withReference(logto); await web.waitFor(logto); @@ -58,7 +58,7 @@ var logto = builder.AddLogto("logto", postgres, databaseName: "logto_db", port: 3001, adminPort: 3002) .WithDatabaseSeeding(); -builder.AddProject("web") +builder.AddDotnetProject("web", "../Web/Web.csproj") .WithReference(logto) .WaitFor(logto); diff --git a/src/frontend/src/content/docs/integrations/security/zitadel/zitadel-connect.mdx b/src/frontend/src/content/docs/integrations/security/zitadel/zitadel-connect.mdx index 81909f336b..6174103e0a 100644 --- a/src/frontend/src/content/docs/integrations/security/zitadel/zitadel-connect.mdx +++ b/src/frontend/src/content/docs/integrations/security/zitadel/zitadel-connect.mdx @@ -46,7 +46,7 @@ const postgres = await builder.addPostgres('postgres'); const zitadel = await builder.addZitadel('zitadel', { port: 8080 }); await zitadel.withDatabase(postgres); -const web = await builder.addProject('web', '../Web/Web.csproj'); +const web = await builder.addDotnetProject('web', '../Web/Web.csproj'); await web.withReference(zitadel); await web.withEnvironment( 'Zitadel__Authority', @@ -67,7 +67,7 @@ var postgres = builder.AddPostgres("postgres"); var zitadel = builder.AddZitadel("zitadel", port: 8080) .WithDatabase(postgres); -builder.AddProject("web") +builder.AddDotnetProject("web", "../Web/Web.csproj") .WithReference(zitadel) .WithEnvironment("Zitadel__Authority", zitadel.GetEndpoint("http")) .WaitFor(zitadel); diff --git a/src/frontend/src/content/docs/testing/advanced-scenarios.mdx b/src/frontend/src/content/docs/testing/advanced-scenarios.mdx index f18e322038..dc61a4ef4f 100644 --- a/src/frontend/src/content/docs/testing/advanced-scenarios.mdx +++ b/src/frontend/src/content/docs/testing/advanced-scenarios.mdx @@ -23,7 +23,7 @@ In your AppHost, mark the resource as explicitly started: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); // This resource is optional and won't start automatically builder.AddContainer("monitoring", "grafana/grafana") @@ -61,7 +61,7 @@ Another approach is to use configuration in your AppHost to conditionally add re ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var api = builder.AddProject("api"); +var api = builder.AddDotnetProject("api", "../Api/Api.csproj"); // Only add the database resource if not explicitly disabled if (builder.Configuration.GetValue("AddDatabase", true)) @@ -139,6 +139,8 @@ Because Aspire tests run services in separate processes, you can't inject servic Use on the resource builder after creating the testing builder to set environment variables for specific resources. You access the resource builder through the `CreateResourceBuilder` method: ```csharp title="IntegrationTest.cs" +using Aspire.Hosting.Dotnet; + [Fact] public async Task ApiUsesTestFeatureFlag() { @@ -146,7 +148,7 @@ public async Task ApiUsesTestFeatureFlag() .CreateAsync(); // Override an environment variable for the "api" resource - appHost.CreateResourceBuilder("api") + appHost.CreateResourceBuilder("api") .WithEnvironment("FeatureFlags__NewCheckout", "true"); await using var app = await appHost.BuildAsync(); diff --git a/src/frontend/tests/e2e/markdown-rendering.spec.ts b/src/frontend/tests/e2e/markdown-rendering.spec.ts index f121f6db74..7acbc4e830 100644 --- a/src/frontend/tests/e2e/markdown-rendering.spec.ts +++ b/src/frontend/tests/e2e/markdown-rendering.spec.ts @@ -66,7 +66,7 @@ test('contributor guide renders common Markdown as semantic HTML', async ({ page ); await expect(main.locator('p code').filter({ hasText: 'Inline code' })).toBeVisible(); await expect( - main.locator('pre code').filter({ hasText: 'builder.AddProject' }).first() + main.locator('pre code').filter({ hasText: 'builder.AddDotnetProject("apiservice"' }).first() ).toBeVisible(); await expect( main.locator('blockquote').filter({ hasText: 'This is a note or important callout.' }) From 01cbe6cc1259b2930605259e4652aa0e23a68576 Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 17:11:14 -0500 Subject: [PATCH 07/12] docs: move Blazor, WPF/WinForms, and container files samples to AddDotnetProject - Blazor hosting/connect/get-started use AddBlazorWasmApp and AddDotnetProjectBlazorGateway (validated in C# and TS AppHosts) - WPF/WinForms registration uses AddDotnetProject with TS/C#/Go tabs - container-files samples use AddDotnetProject - Fix 13.6 release notes anchor Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../content/docs/app-host/container-files.mdx | 10 +- .../integrations/dotnet/blazor-connect.mdx | 49 +++--- .../dotnet/blazor-get-started.mdx | 4 +- .../integrations/dotnet/blazor-hosting.mdx | 151 ++++++------------ .../integrations/frameworks/wpf-winforms.mdx | 100 +++++++++--- .../content/docs/whats-new/aspire-13-6.mdx | 2 +- 6 files changed, 167 insertions(+), 149 deletions(-) diff --git a/src/frontend/src/content/docs/app-host/container-files.mdx b/src/frontend/src/content/docs/app-host/container-files.mdx index 080ecfb63d..404dbd1f47 100644 --- a/src/frontend/src/content/docs/app-host/container-files.mdx +++ b/src/frontend/src/content/docs/app-host/container-files.mdx @@ -99,7 +99,7 @@ const builder = await createBuilder(); const frontend = await builder.addViteApp("frontend", "../frontend"); await frontend.withContainerFilesSource("/app/dist"); -const api = await builder.addProject("api", "../Api/Api.csproj"); +const api = await builder.addDotnetProject("api", "../Api/Api.csproj"); await api.publishWithContainerFiles(frontend, "./wwwroot"); await builder.build().run(); @@ -351,7 +351,7 @@ var builder = DistributedApplication.CreateBuilder(args); var frontend = builder.AddViteApp("frontend", "../frontend"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishWithContainerFiles(frontend, "./wwwroot"); builder.Build().Run(); @@ -365,7 +365,7 @@ const builder = await createBuilder(); const frontend = await builder.addViteApp("frontend", "../frontend"); -const api = await builder.addProject("api", "./Api/Api.csproj") +const api = await builder.addDotnetProject("api", "../Api/Api.csproj") .publishWithContainerFiles(frontend, "./wwwroot"); await builder.build().run(); @@ -414,7 +414,7 @@ await builder.build().run(); This produces a self-contained Nginx container that serves the frontend application, with no external volume mounts or runtime file copying needed. -`PublishWithContainerFiles` only applies in publish mode — it has no effect during `aspire run`. The destination resource must implement `IContainerFilesDestinationResource` (such as `ProjectResource`), and the source resource must implement `IResourceWithContainerFiles`. +`PublishWithContainerFiles` only applies in publish mode — it has no effect during `aspire run`. The destination resource must implement `IContainerFilesDestinationResource` (such as a .NET project added with `AddDotnetProject`), and the source resource must implement `IResourceWithContainerFiles`. ### Customize the source path @@ -426,7 +426,7 @@ By default, the source resource exports files from its container based on its co var frontend = builder.AddViteApp("frontend", "../frontend") .WithContainerFilesSource("/app/dist"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .PublishWithContainerFiles(frontend, "./wwwroot"); ``` diff --git a/src/frontend/src/content/docs/integrations/dotnet/blazor-connect.mdx b/src/frontend/src/content/docs/integrations/dotnet/blazor-connect.mdx index 4b23f597d5..a561c00b19 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/blazor-connect.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/blazor-connect.mdx @@ -47,25 +47,6 @@ Common properties used in Blazor-hosted app models are: Use the AppHost to connect APIs to a Blazor WebAssembly project resource, then associate the client app with a Blazor Gateway. - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -var weatherApi = builder.AddProject("weatherapi") - .WithHttpEndpoint(name: "http"); - -var blazorApp = builder.AddBlazorWasmProject("app", "../Client/Client.csproj") - .WithReference(weatherApi.GetEndpoint("http")); - -builder.AddBlazorGateway("gateway") - .WithExternalHttpEndpoints() - .WithBlazorClientApp(blazorApp); - -builder.Build().Run(); -``` - - ```typescript title="apphost.mts" @@ -73,16 +54,17 @@ import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const weatherApi = await builder - .addProject('weatherapi', '../WeatherApi/WeatherApi.csproj') - .withHttpEndpoint({ name: 'http' }); +const weatherApi = await builder.addDotnetProject( + 'weatherapi', + '../WeatherApi/WeatherApi.csproj' +); const blazorApp = await builder .addBlazorWasmProject('app', '../Client/Client.csproj') .withReference(await weatherApi.getEndpoint('http')); await builder - .addBlazorGateway('gateway') + .addDotnetProjectBlazorGateway('gateway') .withExternalHttpEndpoints() .withBlazorClientApp(blazorApp); @@ -90,8 +72,27 @@ await builder.build().run(); ``` - + + +```csharp title="AppHost.cs" +#pragma warning disable ASPIREBLAZOR001 + +var builder = DistributedApplication.CreateBuilder(args); + +var weatherApi = builder.AddDotnetProject("weatherapi", "../WeatherApi/WeatherApi.csproj"); + +var blazorApp = builder.AddBlazorWasmApp("app", "../Client/Client.csproj") + .WithReference(weatherApi.GetEndpoint("http")); +builder.AddDotnetProjectBlazorGateway("gateway") + .WithExternalHttpEndpoints() + .WithBlazorClientApp(blazorApp); + +builder.Build().Run(); +``` + + + ## Connect from consuming apps Any app resource that references the same APIs can consume the `services__...` values directly. diff --git a/src/frontend/src/content/docs/integrations/dotnet/blazor-get-started.mdx b/src/frontend/src/content/docs/integrations/dotnet/blazor-get-started.mdx index c99b49cde9..8cb51231e9 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/blazor-get-started.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/blazor-get-started.mdx @@ -23,8 +23,8 @@ The Aspire Blazor hosting integration helps you model a Blazor WebAssembly proje The integration adds AppHost APIs that let you: -- Add a Blazor WebAssembly project resource with . -- Add a Blazor Gateway resource with . +- Add a Blazor WebAssembly project resource with (`addBlazorWasmProject` in TypeScript). +- Add a Blazor Gateway resource with . - Associate the client app with the gateway by using `WithBlazorClientApp` / `withBlazorClientApp`. ## Why use Blazor hosting with Aspire diff --git a/src/frontend/src/content/docs/integrations/dotnet/blazor-hosting.mdx b/src/frontend/src/content/docs/integrations/dotnet/blazor-hosting.mdx index a8eeff7fb8..973a5be05c 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/blazor-hosting.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/blazor-hosting.mdx @@ -74,124 +74,109 @@ This updates your `aspire.config.json` with the Blazor hosting package: -## Add Blazor WebAssembly project +## Add a Blazor WebAssembly app -Use to add a Blazor WebAssembly project to the AppHost model. +Use to add a Blazor WebAssembly project to the AppHost model. In TypeScript AppHosts, this API is named `addBlazorWasmProject`. Aspire doesn't launch the WebAssembly app as its own process; a [Blazor Gateway](#add-a-blazor-gateway) serves it to the browser. - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -var api = builder.AddProject("api"); - -var blazorApp = builder.AddBlazorWasmProject("app", "../MyBlazorApp/MyBlazorApp.csproj"); -blazorApp.WithReference(api); - -builder.Build().Run(); -``` - - -```typescript title="apphost.mts" +```typescript title="apphost.mts" twoslash import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const api = await builder.addProject('api', '../MyApi/MyApi.csproj'); +const api = await builder.addDotnetProject('api', '../MyApi/MyApi.csproj'); const blazorApp = await builder .addBlazorWasmProject('app', '../MyBlazorApp/MyBlazorApp.csproj') - .withReference(await api.getEndpoint('http')); + .withReference(api); await builder.build().run(); ``` - - -## Add Blazor Gateway - -Use to add the Blazor Gateway resource. The gateway is the browser-facing endpoint for your hosted Blazor app. - - ```csharp title="AppHost.cs" +#pragma warning disable ASPIREBLAZOR001 + var builder = DistributedApplication.CreateBuilder(args); -var gateway = builder.AddBlazorGateway("gateway") - .WithExternalHttpEndpoints(); +var api = builder.AddDotnetProject("api", "../MyApi/MyApi.csproj"); + +var blazorApp = builder.AddBlazorWasmApp("app", "../MyBlazorApp/MyBlazorApp.csproj") + .WithReference(api); builder.Build().Run(); ``` + + +## Add a Blazor Gateway + +Use to add the Blazor Gateway resource. The gateway is the browser-facing endpoint for your Blazor app: it serves the WebAssembly client and forwards the client's API and telemetry traffic. Aspire provides the gateway, so you don't need to create a gateway project. + + -```typescript title="apphost.mts" +```typescript title="apphost.mts" twoslash import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const gateway = await builder - .addBlazorGateway('gateway') + .addDotnetProjectBlazorGateway('gateway') .withExternalHttpEndpoints(); await builder.build().run(); ``` - - -:::note - marks the gateway endpoint as externally accessible so browser traffic can reach your app. -::: - -## Associate a client app with the gateway - -Use ', 'Aspire.Hosting.ApplicationModel.IResourceBuilder', 'string', 'string', 'bool']} /> to bind the WebAssembly project resource to the Blazor Gateway: - - ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); -var weatherApi = builder.AddProject("weatherapi"); - -var blazorApp = builder.AddBlazorWasmProject("app", "../MyBlazorApp/MyBlazorApp.csproj"); -blazorApp.WithReference(weatherApi); - -var gateway = builder.AddBlazorGateway("gateway") +var gateway = builder.AddDotnetProjectBlazorGateway("gateway") .WithExternalHttpEndpoints(); -gateway.WithBlazorClientApp(blazorApp); - builder.Build().Run(); ``` + + + marks the gateway endpoint as externally accessible so browser traffic can reach your app. + +:::note[Upgrading to Aspire 17?] +`AddBlazorGateway` creates a gateway based on the legacy `ProjectResource` type. Replace it with `AddDotnetProjectBlazorGateway`; the `WithBlazorClientApp` call stays the same. If you customized the gateway's publishing, review that configuration after you switch. For the broader move off `ProjectResource`, see [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). +::: + +## Associate a client app with the gateway + +Use ', 'Aspire.Hosting.ApplicationModel.IResourceBuilder', 'string', 'string', 'bool']} /> to bind the WebAssembly app resource to the Blazor Gateway: + + -```typescript title="apphost.mts" +```typescript title="apphost.mts" twoslash import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -const weatherApi = await builder.addProject( +const weatherApi = await builder.addDotnetProject( 'weatherapi', '../WeatherApi/WeatherApi.csproj' ); const blazorApp = await builder .addBlazorWasmProject('app', '../MyBlazorApp/MyBlazorApp.csproj') - .withReference(await weatherApi.getEndpoint('http')); + .withReference(weatherApi); await builder - .addBlazorGateway('gateway') + .addDotnetProjectBlazorGateway('gateway') .withExternalHttpEndpoints() .withBlazorClientApp(blazorApp); @@ -199,52 +184,21 @@ await builder.build().run(); ``` - - - - -## Add a Blazor Gateway for a C# project resource - -[`AddDotnetProjectBlazorGateway`](/reference/api/csharp/aspire.hosting.blazor/blazorgatewayextensions/methods/#adddotnetprojectblazorgateway) adds a Blazor Gateway that hosts a [`DotnetProjectResource`](/integrations/frameworks/dotnet/dotnet-host/) (a C# project or file-based app added with ) instead of the standard `ProjectResource`-based gateway. Use the distinct [`WithBlazorClientApp`](/reference/api/csharp/aspire.hosting.blazor/blazorgatewayextensions/methods/#withblazorclientapp-iresourcebuilder-dotnetprojectresource-iresourcebuilder-blazorwasmappresource-string-string-bool) overload on this resource to attach a Blazor WebAssembly client app: - - - - -```typescript title="apphost.mts" twoslash -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -const client = await builder.addBlazorWasmProject( - 'client', - '../Client/Client.csproj' -); -const gateway = await builder.addDotnetProjectBlazorGateway('gateway'); - -await gateway.withExternalHttpEndpoints(); -await gateway.withBlazorClientApp(client); - -await builder.build().run(); -``` - - - ```csharp title="AppHost.cs" +#pragma warning disable ASPIREBLAZOR001 + var builder = DistributedApplication.CreateBuilder(args); -#pragma warning disable ASPIREBLAZOR001 +var weatherApi = builder.AddDotnetProject("weatherapi", "../WeatherApi/WeatherApi.csproj"); -var client = builder.AddBlazorWasmProject("client"); +var blazorApp = builder.AddBlazorWasmApp("app", "../MyBlazorApp/MyBlazorApp.csproj") + .WithReference(weatherApi); builder.AddDotnetProjectBlazorGateway("gateway") .WithExternalHttpEndpoints() - .WithBlazorClientApp(client); + .WithBlazorClientApp(blazorApp); builder.Build().Run(); ``` @@ -252,20 +206,21 @@ builder.Build().Run(); -:::note -`Aspire.Hosting.Blazor` is a prerelease package. Its APIs remain unstable and may change in future releases. +The gateway forwards the client's service references to the browser app and is included when you publish the AppHost. Browser-debugger resources are created only for local runs. -Starting with Aspire 13.6, and its `WithBlazorClientApp` overload no longer emit [`ASPIREDOTNETPROJECT001`](/diagnostics/aspiredotnetproject001/). You can remove existing suppressions for this diagnostic after upgrading. + -The separate [`ASPIREBLAZOR001`](/diagnostics/aspireblazor001/) diagnostic still applies to experimental Blazor hosting types, such as `BlazorWasmAppResource`. Keep the `ASPIREBLAZOR001` suppression in the example. +:::note +`Aspire.Hosting.Blazor` is a prerelease package, and its APIs may change in future releases. Experimental Blazor hosting types, such as `BlazorWasmAppResource`, report the [`ASPIREBLAZOR001`](/diagnostics/aspireblazor001/) diagnostic, so the C# examples suppress it. ::: - -The gateway forwards the client's service references and supports publishing through the shared Blazor client attachment and publish-companion pipeline. Browser-debugger resources are created only for local runs. - ## See also - [Get started with Blazor hosting](/integrations/dotnet/blazor-get-started/) - [Connect Blazor apps and APIs](/integrations/dotnet/blazor-connect/) - [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) -- [ASPIREDOTNETPROJECT001](/diagnostics/aspiredotnetproject001/) +- [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) - [Aspire integrations overview](/integrations/overview/) diff --git a/src/frontend/src/content/docs/integrations/frameworks/wpf-winforms.mdx b/src/frontend/src/content/docs/integrations/frameworks/wpf-winforms.mdx index 97f096a07e..21cdd0b571 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/wpf-winforms.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/wpf-winforms.mdx @@ -4,7 +4,7 @@ description: Learn how to orchestrate WPF and Windows Forms desktop applications --- import { Image } from 'astro:assets'; -import { Steps } from '@astrojs/starlight/components'; +import { Steps, Tabs, TabItem } from '@astrojs/starlight/components'; import dotnetIcon from '@assets/icons/dotnet.svg'; import ApiReference from '@components/ApiReference.astro'; @@ -17,7 +17,7 @@ import ApiReference from '@components/ApiReference.astro'; data-zoom-off /> -WPF (Windows Presentation Foundation) and Windows Forms are .NET desktop UI frameworks for building Windows applications. Because they are standard .NET projects, you can register them in an Aspire AppHost alongside your backend services using the same API you use for web and worker services. Aspire then starts and monitors the desktop app as a local process resource when you run the AppHost during development. +WPF (Windows Presentation Foundation) and Windows Forms are .NET desktop UI frameworks for building Windows applications. Because they are standard .NET projects, you can register them in an Aspire AppHost alongside your backend services with the same API you use for web and worker services. Aspire then starts and monitors the desktop app as a local process resource when you run the AppHost during development. :::note WPF and Windows Forms applications require Windows and are **not** containerized or included in [`aspire deploy`](/reference/cli/commands/aspire-deploy/) output. Aspire orchestrates them as local processes during development only. For production deployment, use your existing desktop tooling (MSIX, ClickOnce, and so on). @@ -25,35 +25,66 @@ WPF and Windows Forms applications require Windows and are **not** containerized ## Add WPF or Windows Forms to the AppHost -No additional NuGet package is required. Add the desktop project reference to the AppHost and call `AddProject` to register it. +Desktop projects use the [.NET / C# app integration](/integrations/frameworks/dotnet/dotnet-host/), so no desktop-specific package is required. -1. **Add a project reference** from your AppHost `.csproj` to the WPF or Windows Forms project: +1. **Add the .NET hosting integration** to your AppHost, if it isn't already installed: - ```xml title="AppHost.csproj" - - - + ```bash title="Terminal" + aspire add Aspire.Hosting.Dotnet ``` -1. **Register the project** in your AppHost and wire up any service references it needs: +1. **Register the project** in your AppHost by path and wire up any service references it needs: + + + + + ```typescript title="apphost.mts" + import { createBuilder } from './.aspire/modules/aspire.mjs'; + + const builder = await createBuilder(); + + const api = await builder.addDotnetProject('api', '../ApiService/ApiService.csproj'); + + await builder + .addDotnetProject('desktop', '../MyWpfApp/MyWpfApp.csproj') + .withReference(api) + .waitFor(api); + + await builder.build().run(); + ``` + + + ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); - var api = builder.AddProject("api"); + var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"); - builder.AddProject("desktop") + builder.AddDotnetProject("desktop", "../MyWpfApp/MyWpfApp.csproj") .WithReference(api) .WaitFor(api); - // After adding all resources, run the app... builder.Build().Run(); ``` - When you run the AppHost, the desktop application starts automatically as a process resource alongside all other registered services. + + + + ```go title="apphost.go" + api := builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") + + builder.AddDotnetProject("desktop", "../MyWpfApp/MyWpfApp.csproj"). + WithReference(api). + WaitFor(api) + ``` + + + + When you run the AppHost, the desktop application starts automatically as a process resource alongside all other registered services. 1. **Add service discovery** to the desktop project so it can resolve Aspire-managed service addresses at runtime. Reference the `Aspire.ServiceDefaults` project (or install `Microsoft.Extensions.ServiceDiscovery` directly), then configure the generic host in your startup code. For **WPF**, override `OnStartup` in `App.xaml.cs`: @@ -112,7 +143,36 @@ No additional NuGet package is required. Add the desktop project reference to th ## Dev-only orchestration -A common pattern is to register the desktop app only during local development and skip it in CI or staging environments. Use `builder.Environment.IsDevelopment()` to add the resource conditionally: +A common pattern is to register the desktop app only during local development and skip it in CI or staging environments. Check the AppHost environment to add the resource conditionally: + + + + +```typescript title="apphost.mts" +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); +const env = await builder.environment.get(); + +const postgres = await builder.addPostgres('postgres'); +const db = await postgres.addDatabase('mydb'); + +const api = await builder + .addDotnetProject('api', '../ApiService/ApiService.csproj') + .withReference(db); + +if (await env.isDevelopment()) { + await builder + .addDotnetProject('desktop', '../MyWpfApp/MyWpfApp.csproj') + .withReference(api) + .waitFor(api); +} + +await builder.build().run(); +``` + + + ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); @@ -120,31 +180,32 @@ var builder = DistributedApplication.CreateBuilder(args); var postgres = builder.AddPostgres("postgres") .AddDatabase("mydb"); -var api = builder.AddProject("api") +var api = builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") .WithReference(postgres); if (builder.Environment.IsDevelopment()) { - builder.AddProject("desktop") + builder.AddDotnetProject("desktop", "../MyWpfApp/MyWpfApp.csproj") .WithReference(api) .WaitFor(api); } -// After adding all resources, run the app... builder.Build().Run(); ``` + + ## Limitations - **Windows only**: WPF and Windows Forms require Windows. On macOS or Linux, the desktop resource will fail to start because the .NET WPF/WinForms runtime is unavailable on those platforms. - **No deployment support**: [`aspire deploy`](/reference/cli/commands/aspire-deploy/) does not produce deployment artifacts for desktop apps. They are treated as development-time resources only. -- **Dashboard lifecycle**: Desktop apps start automatically when the AppHost runs. They cannot be started or stopped on demand from the Aspire dashboard the same way containerized services can. +- **Dashboard lifecycle**: Desktop apps start automatically when the AppHost runs. Use the dashboard's **Stop**, **Start**, **Restart**, and **Rebuild** commands to control the desktop app process. ## Comparison with .NET MAUI | Feature | WPF / WinForms | .NET MAUI | |---------|---------------|-----------| -| Aspire hosting package | None — uses standard `AddProject` | `Aspire.Hosting.Maui` | +| Aspire hosting package | `Aspire.Hosting.Dotnet` (`AddDotnetProject`) | `Aspire.Hosting.Maui` | | Platform support | Windows only | Windows, macOS, iOS, Android | | Dev Tunnels support | Not applicable | Built-in for iOS/Android | | Production deployment with Aspire | Not supported | Not supported | @@ -154,6 +215,7 @@ For cross-platform desktop and mobile scenarios, consider [.NET MAUI integration ## See also - [.NET MAUI integration](/integrations/dotnet/maui/) +- [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) - [AppHost overview](/get-started/app-host/) - [Service discovery in .NET](/fundamentals/networking-overview/) - [WPF documentation](https://learn.microsoft.com/dotnet/desktop/wpf/) diff --git a/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx b/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx index 02ce65092c..2bf3c8cc42 100644 --- a/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx +++ b/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx @@ -709,7 +709,7 @@ Existing integrations add new workflows and safer defaults: - **MongoDB automatic TLS.** Local MongoDB resources now use Aspire's shared certificate configuration, including standalone servers. Existing plaintext clients should review the [TLS migration guidance](#mongodb-now-uses-automatic-tls-during-local-runs). - **Microsoft Foundry Toolboxes.** bundles tools behind one MCP endpoint and manages immutable versions as tool configuration changes. MCP approval policies are discovery metadata that the consuming application must enforce. See the [Toolbox walkthrough](/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host/#add-a-toolbox). - **Remote Foundry Local services.** now accepts an endpoint, so an AppHost, including one on WSL2 or Linux, can observe a Foundry Local service already running on another host (for example, a Windows GPU box) without starting, stopping, or downloading models on it. The integration also handles the newer `foundry server` CLI generation. See [Connect to a remote Foundry Local service](/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host/#connect-to-a-remote-foundry-local-service). -- **Blazor WebAssembly debugging.** Standalone and hosted WebAssembly apps can expose dashboard commands for starting and stopping an Edge or Chrome debugging session during local runs. The related Dotnet project gateway APIs are also available to polyglot AppHosts and participate in publishing, but remain unstable and may change. See [Blazor gateway hosting](/integrations/dotnet/blazor-hosting/#add-a-blazor-gateway-for-a-c-project-resource). +- **Blazor WebAssembly debugging.** Standalone and hosted WebAssembly apps can expose dashboard commands for starting and stopping an Edge or Chrome debugging session during local runs. The related Dotnet project gateway APIs are also available to polyglot AppHosts and participate in publishing, but remain unstable and may change. See [Blazor gateway hosting](/integrations/dotnet/blazor-hosting/#add-a-blazor-gateway). - **Dev Tunnel discovery and expiration.** Tunnel, inspect, and local endpoint URLs appear as highlighted resource properties, and a **Show tunnel URLs** command surfaces them through the dashboard Interaction Service. also configures idle expiration for new or reused tunnels, in whole hours from one hour through 30 days. - **Radius recipe configuration.** Experimental APIs configure recipe parameters and required secrets globally or per resource from the AppHost. The integration now recommends [Radius v0.60.2](https://github.com/radius-project/radius/releases/tag/v0.60.2); v0.60.0 remains the minimum supported control-plane version. - **Radius backing connections.** Consumer addresses and credentials now come from the backing resource's deployed schema and recipe outputs rather than local endpoint guesses. New publish diagnostics catch unsupported endpoints, database mappings, credentials, and secret collisions. Review the [Radius deployment guide](/deployment/radius/) before upgrading. From ca51788560555d2d3a30ed9c41fd08bdd5ca8e59 Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 17:23:31 -0500 Subject: [PATCH 08/12] docs: turn project-resources into a legacy reference and move current guidance to dotnet-host - Move endpoint filtering, coordinated builds/restore, and multithreaded builds to dotnet-host - Trim launch-profile and networking duplication to pointers - Retitle as Legacy project resources and move it below the migration guide in the sidebar - Repoint inbound links to dotnet-host Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../config/sidebar/integrations.topics.ts | 2 +- .../docs/fundamentals/networking-overview.mdx | 6 +- .../get-started/add-aspire-existing-app.mdx | 2 +- .../dotnet/dotnet-tool-resources.mdx | 2 +- .../integrations/dotnet/project-resources.mdx | 649 ++---------------- .../frameworks/dotnet/dotnet-host.mdx | 78 +++ .../docs/languages-and-runtimes/index.mdx | 2 +- .../content/docs/whats-new/aspire-13-6.mdx | 2 +- 8 files changed, 131 insertions(+), 612 deletions(-) diff --git a/src/frontend/config/sidebar/integrations.topics.ts b/src/frontend/config/sidebar/integrations.topics.ts index e599e18f7e..a1e9480952 100644 --- a/src/frontend/config/sidebar/integrations.topics.ts +++ b/src/frontend/config/sidebar/integrations.topics.ts @@ -1516,13 +1516,13 @@ export const integrationTopics: StarlightSidebarTopicsUserConfig = { label: 'Set up C# apps by path in the AppHost', slug: 'integrations/frameworks/dotnet/dotnet-host', }, - { label: 'Project resources', slug: 'integrations/dotnet/project-resources' }, { label: 'C# file-based apps', slug: 'integrations/dotnet/csharp-file-based-apps' }, { label: 'Launch profiles', slug: 'integrations/dotnet/launch-profiles' }, { label: 'Migrate to DotnetProjectResource', slug: 'integrations/dotnet/migrate-dotnet-project-resource', }, + { label: 'Legacy project resources', slug: 'integrations/dotnet/project-resources' }, { label: '.NET tool resources', slug: 'integrations/dotnet/dotnet-tool-resources' }, { label: 'Blazor', diff --git a/src/frontend/src/content/docs/fundamentals/networking-overview.mdx b/src/frontend/src/content/docs/fundamentals/networking-overview.mdx index 54e01c4024..8e24b15c5a 100644 --- a/src/frontend/src/content/docs/fundamentals/networking-overview.mdx +++ b/src/frontend/src/content/docs/fundamentals/networking-overview.mdx @@ -151,8 +151,8 @@ Some endpoint behavior depends on the resource type. Keep those details with the For .NET-specific endpoint behavior, see [C# launch - profiles](/integrations/dotnet/launch-profiles/) and [Project - resources](/integrations/dotnet/project-resources/). + profiles](/integrations/dotnet/launch-profiles/) and [.NET / C# apps in the + AppHost](/integrations/frameworks/dotnet/dotnet-host/). ## Ports and proxies @@ -456,7 +456,7 @@ For network communication, the `Protocol` property supports **TCP** and **UDP**, For more information, see the available properties of the [EndpointAnnotation properties](https://learn.microsoft.com/dotnet/api/aspire.hosting.applicationmodel.endpointannotation#properties). -For project-resource-specific endpoint filtering, see [Project resources](/integrations/dotnet/project-resources/). +For .NET project endpoint filtering, see [Filter endpoints in environment variables](/integrations/frameworks/dotnet/dotnet-host/#filter-endpoints-in-environment-variables). ### Excluding endpoints from service discovery diff --git a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx index 8a21f81c33..ea293fe37d 100644 --- a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx +++ b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx @@ -858,7 +858,7 @@ func main() { These scenarios are starting points, not mutually exclusive modes. Most real apps mix workload-specific resources, containers, shared infrastructure, project-path references, and occasional custom commands in a single application model. The key is that dependencies, endpoints, configuration, and startup behavior become explicit. -For more examples, see [Project resources](/integrations/dotnet/project-resources/), [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/), [Executable resources](/app-host/executable-resources/), and [Migrate from Docker Compose](/app-host/migrate-from-docker-compose/). +For more examples, see [.NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/), [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/), [Executable resources](/app-host/executable-resources/), and [Migrate from Docker Compose](/app-host/migrate-from-docker-compose/). ## Add telemetry configuration (optional) diff --git a/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx b/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx index 3b3fc04cbe..85f81021f2 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/dotnet-tool-resources.mdx @@ -371,5 +371,5 @@ var tool = builder.AddDotnetTool("my-tool", "dotnet-tool-package"); ## See also - [ASPIREDOTNETTOOL diagnostic](/diagnostics/aspiredotnettool001/) -- [Project resources](/integrations/dotnet/project-resources/) +- [.NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) - [Executable resources](/app-host/executable-resources/) diff --git a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx index 8738f5fa71..a108c54f52 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx @@ -1,16 +1,13 @@ --- -title: Project resources -seoTitle: "Add C# project resources to your Aspire AppHost" -description: Learn how to add .NET projects as resources in your Aspire AppHost — with examples for both AppHost.cs (C#) and apphost.mts (TypeScript). +title: Legacy project resources +seoTitle: "Legacy AddProject and AddCSharpApp resources in Aspire" +description: Reference for the obsolete AddProject and AddCSharpApp APIs and ProjectResource model, and where to find their replacements in the Aspire Dotnet integration. --- import { Image } from 'astro:assets'; -import { Aside, Tabs, TabItem } from '@astrojs/starlight/components'; +import { Tabs, TabItem } from '@astrojs/starlight/components'; import LearnMore from '@components/LearnMore.astro'; import dotnetIcon from '@assets/icons/dotnet.svg'; -import proxyWithReplicas from '@assets/fundamentals/networking/proxy-with-replicas-1x.png'; -import proxyHostPortAndRandomPort from '@assets/fundamentals/networking/proxy-host-port-and-random-port-1x.png'; -import proxyWithRandomPorts from '@assets/fundamentals/networking/proxy-with-random-ports-1x.png'; import ApiReference from '@components/ApiReference.astro'; -This article is the reference for modeling .NET projects as first-class Aspire resources in your AppHost. It enumerates the AppHost APIs — with examples for both `AppHost.cs` and `apphost.mts` — that you use to add, configure, and connect a .NET project resource in your [`AppHost`](/get-started/app-host/) project. +This page is a reference for AppHosts that still use the legacy `ProjectResource` model through `AddProject`, `AddCSharpApp`, or TypeScript `addProject`. -## When to use project resources - -Use project resources when you need to: - -- Orchestrate an ASP.NET Core, worker, or console project from an AppHost. -- Connect the project to other Aspire resources with , service discovery, and generated connection strings. -- Reuse launch profile settings and ASP.NET Core endpoint discovery from `launchSettings.json`. - -In a **C# AppHost**, `AddProject` references the target project through a generated `Projects.*` type, created from a `ProjectReference` in the AppHost `.csproj`. In a **TypeScript AppHost**, `addProject(name, path)` takes the path to the `.csproj` file directly — no generated type or project file reference is needed. - -For single-file apps or quick experiments that don't need a `ProjectReference`, use [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) instead. +:::caution[These APIs are obsolete] +Starting in Aspire 17, `AddProject` and `AddCSharpApp` are obsolete. For new resources, use `AddDotnetProject` from the [.NET / C# integration](/integrations/frameworks/dotnet/dotnet-host/). To move an existing AppHost, see [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). +::: -## Basic workflow +## Add a legacy project resource -Start by adding a `ProjectReference` from the AppHost to the target project: +A C# AppHost references the target project with a `ProjectReference` marked as an Aspire project resource: ```xml title="AppHost.csproj" - + ``` -When the AppHost builds, Aspire generates a metadata type in the `Projects` namespace for that reference. Use the generated type with : +When the AppHost builds, Aspire generates a metadata type in the `Projects` namespace for each marked reference. uses that type to locate the project: ```csharp title="AppHost.cs" var builder = DistributedApplication.CreateBuilder(args); @@ -59,633 +50,83 @@ var api = builder.AddProject("api"); builder.Build().Run(); ``` -The path to the project comes from the `ProjectReference`, so `AddProject` doesn't need a `.csproj` path. This is the main difference from , which points directly to a file, project, or directory. - - - - -In a TypeScript AppHost, pass the path to the `.csproj` file directly — no `ProjectReference` in the AppHost project file is needed: - -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -const api = await builder.addProject("api", "../ApiService/ApiService.csproj"); - -await builder.build().run(); -``` - - - - -In a Go AppHost, use `AddDotnetProject` and pass the path to the `.csproj` file directly — no `ProjectReference` in the AppHost project is needed. Add the `Aspire.Hosting.Dotnet` integration to your AppHost, then call it: - -```go title="apphost.go" -builder, err := aspire.CreateBuilder() -if err != nil { - log.Fatal(aspire.FormatError(err)) -} - -api := builder.AddDotnetProject("api", "../ApiService/ApiService.csproj") - -app, err := builder.Build() -if err != nil { - log.Fatal(aspire.FormatError(err)) -} -if err := app.Run(); err != nil { - log.Fatal(aspire.FormatError(err)) -} -``` - - - - -## Resource dependencies - -Project resources participate fully in the Aspire application model. You can reference other resources, flow connection strings and service discovery information, and expose endpoints like any other Aspire resource: - - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -var cache = builder.AddRedis("cache"); -var postgres = builder.AddPostgres("postgres"); -var db = postgres.AddDatabase("appdb"); - -builder.AddProject("api") - .WithReference(cache) - .WithReference(db) - .WithExternalHttpEndpoints(); - -builder.Build().Run(); -``` - - -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -const cache = await builder.addRedis("cache"); -const postgres = await builder.addPostgres("postgres"); -const db = await postgres.addDatabase("appdb"); - -await builder.addProject("api", "../ApiService/ApiService.csproj") - .withReference(cache) - .withReference(db) - .withExternalHttpEndpoints(); - -await builder.build().run(); -``` - - -```go title="apphost.go" -builder, err := aspire.CreateBuilder() -if err != nil { - log.Fatal(aspire.FormatError(err)) -} - -cache := builder.AddRedis("cache") -postgres := builder.AddPostgres("postgres") -db := postgres.AddDatabase("appdb") - -api := builder.AddDotnetProject("api", "../ApiService/ApiService.csproj"). - WithReference(cache). - WithReference(db). - WithExternalHttpEndpoints() - -app, err := builder.Build() -if err != nil { - log.Fatal(aspire.FormatError(err)) -} -if err := app.Run(); err != nil { - log.Fatal(aspire.FormatError(err)) -} -``` - - - -The referenced project receives connection strings and service discovery information through environment variables, just like other Aspire resources. - -## Control launch settings and endpoints - -Project resources read launch profiles from the target project's _launchSettings.json_ file: - -```json title="launchSettings.json" -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "applicationUrl": "http://localhost:5066", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "applicationUrl": "https://localhost:7239;http://localhost:5066", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} -``` - -Use the `launchProfileName` option when you want a specific profile: - - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -builder.AddProject( - "inventoryservice", - launchProfileName: "https"); - -builder.Build().Run(); -``` - - -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -await builder.addProject("inventoryservice", "../InventoryService/InventoryService.csproj", { - launchProfileOrOptions: "https", -}); - -await builder.build().run(); -``` - - -```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{LaunchProfileName: aspire.StringPtr("https")})) -``` - - - -The `launchProfileName` argument has the highest precedence. When you don't specify it, Aspire selects the effective launch profile in this order: + takes a path to a project, directory, or file-based `.cs` app instead and doesn't need a `ProjectReference`: -1. The explicit `launchProfileName` argument, if supplied. -2. The AppHost default launch profile from `AppHost:DefaultLaunchProfileName` or `DOTNET_LAUNCH_PROFILE`. -3. The first profile in _launchSettings.json_. -4. No launch profile. - -To force a project resource to run without a launch profile, pass `launchProfileName: null`: - - - ```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -builder.AddProject( - "inventoryservice", - launchProfileName: null); - -builder.Build().Run(); +var worker = builder.AddCSharpApp("worker", "../Worker/Worker.csproj"); ``` - - -The TypeScript AppHost doesn't currently expose a way to explicitly disable launch profile selection. Omit `launchProfileOrOptions` to fall through to the default profile-selection order described above. - - - -For consistency with `dotnet run` and `dotnet watch`, Aspire sets `DOTNET_LAUNCH_PROFILE` on the launched project when an effective launch profile is selected. The selected profile's `environmentVariables` are also passed through to the process. - -The `applicationUrl` values in a project's _launchSettings.json_ are the project-resource equivalent of configuring explicit HTTP and HTTPS endpoints: - - -```csharp title="AppHost.cs" -builder.AddProject("frontend") - .WithHttpEndpoint(port: 5066) - .WithHttpsEndpoint(port: 7239); -``` -```typescript title="apphost.mts" -await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj") - .withHttpEndpoint({ port: 5066 }) - .withHttpsEndpoint({ port: 7239 }); -``` - - -```go title="apphost.go" -builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint(aspire.HttpEndpointPort(5066)). - WithHttpsEndpoint(aspire.HttpsEndpointPort(7239)) -``` - - - -If there's no _launchSettings.json_ file or selected launch profile, project resources don't get HTTP or HTTPS bindings by default. - -When you want to ignore launch profile endpoints or prefer Kestrel endpoint configuration, use the `configure` callback. For ASP.NET Core projects, Aspire can also read endpoint information from Kestrel configuration: - -```json title="appsettings.Development.json" -{ - "Kestrel": { - "Endpoints": { - "Https": { - "Url": "https://*:5271" - } - } - } -} -``` - -With a Kestrel endpoint configured, remove any `applicationUrl` from _launchSettings.json_ before telling the project resource to use Kestrel endpoints. - - - - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); -builder.AddProject( - name: "inventoryservice", - configure: static project => - { - project.ExcludeLaunchProfile = true; - project.ExcludeKestrelEndpoints = false; - }) - .WithHttpsEndpoint(); -``` - - -The TypeScript AppHost doesn't currently expose a `configure` callback for `addProject`. To use Kestrel endpoints, call `withHttpsEndpoint()` directly and omit `launchProfileOrOptions` to prevent launch-profile endpoints from conflicting: +A TypeScript AppHost passes the path to the `.csproj` file: ```typescript title="apphost.mts" import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); -await builder.addProject("inventoryservice", "../InventoryService/InventoryService.csproj") - .withHttpsEndpoint(); - -await builder.build().run(); -``` - - -In a Go AppHost, pass `ExcludeLaunchProfile` and `ExcludeKestrelEndpoints` through `DotnetProjectOptions`: - -```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{ - ExcludeLaunchProfile: aspire.BoolPtr(true), - ExcludeKestrelEndpoints: aspire.BoolPtr(false), -})). - WithHttpsEndpoint() -``` - - - -For ASP.NET Core projects, Aspire reads the selected launch profile and can create endpoints from the `applicationUrl` field in _launchSettings.json_. You can then customize those endpoints with methods like : - - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -builder.AddProject("inventoryservice") - .WithEndpoint("https", endpoint => endpoint.IsProxied = false); -``` - - -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -await builder.addProject("inventoryservice", "../InventoryService/InventoryService.csproj") - .withEndpointCallback("https", async endpoint => { - await endpoint.isProxied.set(false); - }); +const api = await builder.addProject("api", "../ApiService/ApiService.csproj"); await builder.build().run(); ``` - - -```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj"). - WithEndpointCallback("https", func(endpoint aspire.EndpointUpdateContext) { - endpoint.SetIsProxied(aspire.BoolPtr(false)) - }) -``` - - - - For more information about launch profile selection and endpoint generation, see [Launch profiles](/integrations/dotnet/launch-profiles/). - - -## Ports, proxies, and replicas - -When you define a host port for a project resource, Aspire assigns that host port to the proxy in front of the project, not directly to the underlying service. This keeps single-instance and replicated projects consistent, and it means `WithReference` consumers use the proxy endpoint from the generated environment variables. - - - -```csharp title="AppHost.cs" -builder.AddProject("frontend") - .WithHttpEndpoint(port: 5066) - .WithReplicas(2); -``` - - -```typescript title="apphost.mts" -await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj") - .withHttpEndpoint({ port: 5066 }) - .withReplicas(2); -``` - - -```go title="apphost.go" -builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint(aspire.HttpEndpointPort(5066)). - WithReplicas(2) -``` -The following diagram shows this setup: +Legacy project resources support the same resource APIs as other Aspire resources, such as `WithReference`, `WaitFor`, endpoints, and environment variables. For guidance that applies to all .NET project resources, see: -Aspire frontend app networking diagram with specific host port and two replicas. - -With that configuration: +- [Launch profiles](/integrations/dotnet/launch-profiles/) for profile selection and endpoints from _launchSettings.json_ and Kestrel configuration. +- [Inner-loop networking](/fundamentals/networking-overview/) for ports, proxies, and replicas. +- [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) for endpoint filtering, coordinated builds, and publishing. -- The proxy listens on host port `5066`. -- Each project replica listens on its own random internal port. -- The project receives its internal binding through `ASPNETCORE_URLS`. -- Browsers and dependent resources talk to the proxy endpoint, not directly to a replica. +## Select a launch profile -Without , the proxy still fronts the project resource. The host port stays stable, while the project itself listens on a random internal port. +Legacy APIs take the launch profile as a method argument rather than an options object: -```csharp title="AppHost.cs" -builder.AddProject("frontend") - .WithHttpEndpoint(port: 5066); -``` - - -```typescript title="apphost.mts" -await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj") - .withHttpEndpoint({ port: 5066 }); -``` - - -```go title="apphost.go" -builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint(aspire.HttpEndpointPort(5066)) -``` - - - -Aspire frontend app networking diagram with specific host port and random port. - -In this configuration: - -- The proxy still listens on host port `5066`. -- The project listens on a random internal port. -- `ASPNETCORE_URLS` points the project at the internal port, while browsers and other resources continue to use the stable proxy port. -If you omit the host port entirely, Aspire chooses random host and service ports for the endpoint: - - - ```csharp title="AppHost.cs" -builder.AddProject("frontend") - .WithHttpEndpoint(); -``` - - -```typescript title="apphost.mts" -await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj") - .withHttpEndpoint(); -``` - - -```go title="apphost.go" -builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint() -``` - - - -Aspire frontend app networking diagram with random host port and proxy port. - -In this configuration, Aspire assigns a random proxy port for the host-facing endpoint and a separate random internal port for the project. - -## Filter endpoints in environment variables - -Project resource endpoints follow default heuristics. Some endpoints are included in `ASPNETCORE_URLS`, some are published as `HTTP/HTTPS_PORTS`, and some are resolved from Kestrel configuration. Use when you need to filter which endpoints are exposed through environment variables: +builder.AddProject("inventoryservice", launchProfileName: "https"); - - -```csharp title="AppHost.cs" -builder.AddProject("apiservice") - .WithHttpsEndpoint() - .WithHttpsEndpoint(port: 19227, name: "admin") - .WithEndpointsInEnvironment( - filter: static endpoint => - { - return endpoint.Name is not "admin"; - }); -``` - - -```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; +// Run without a launch profile +builder.AddProject("worker", launchProfileName: null); -const builder = await createBuilder(); - -await builder.addProject("apiservice", "../Networking.ApiService/Networking.ApiService.csproj") - .withHttpsEndpoint() - .withHttpsEndpoint({ port: 19227, name: "admin" }) - .withEndpointsInEnvironment(["https"]); // include only "https"; "admin" is excluded - -await builder.build().run(); -``` - - -```go title="apphost.go" -builder.AddDotnetProject("apiservice", "../Networking.ApiService/Networking.ApiService.csproj"). - WithHttpsEndpoint(). - WithHttpsEndpoint(aspire.HttpsEndpointPort(19227), - aspire.HttpsEndpointName("admin")). - WithEndpointsInEnvironment([]string{"https"}) // include only "https"; "admin" is excluded -``` - - - -This keeps the `admin` endpoint out of the environment variables while still defining it in the application model. - - - For more background on bindings, proxies, and endpoint annotations, see [Inner-loop networking](/fundamentals/networking-overview/). - - -## Coordinated builds and restore - -Before resources start, Aspire groups projects that share a compatible SDK and environment context into -generated MSBuild traversal projects under the AppHost's intermediate output. Build groups run serially, -while projects within each traversal group build in parallel and share one NuGet graph restore. Restoring -the group together avoids repeating restore work for overlapping dependency graphs, without introducing -solution-specific MSBuild properties. - -Because the group restore doesn't invoke each root project's `Restore` target separately, custom targets -attached directly to that target — such as `BeforeTargets="Restore"` or `AfterTargets="Restore"` — don't run -for each project. - -If a project relies on those hooks, opt back in to restoring projects individually by setting -`Aspire:Dotnet:RestoreProjectsIndividually` to `true` in the **AppHost's configuration**: - -```json title="appsettings.json" +// Use Kestrel endpoints instead of launch profile endpoints +builder.AddProject("catalog", configure: static project => { - "Aspire": { - "Dotnet": { - "RestoreProjectsIndividually": true - } - } -} -``` - -The environment-variable equivalent is `Aspire__Dotnet__RestoreProjectsIndividually=true`. The setting -defaults to `false`, is read once when the build plan is created, and applies to every generated traversal -in that AppHost — it isn't a per-resource runtime environment variable. With individual restore, each root -project's restore runs serially while builds remain parallel. - -:::note -A traversal also falls back to restoring projects individually when its top-level MSBuild context enables -`RestoreUseStaticGraphEvaluation`, because NuGet's static restore engine requires a restore-capable entry -project rather than the generated SDK-less traversal. The selected reason is logged on the build resource; -restore failures aren't retried using another strategy. -::: - -File-based apps, project-specific build environments, individual Rebuild commands, and publishing keep -their existing build and restore paths. - -### Multithreaded builds - -Aspire probes the `dotnet` SDK selected for each build context — honoring `global.json` — and, when it -supports the MSBuild `-mt` switch, passes it to coordinated traversal builds, file-based app builds, and -individual project [rebuild commands](/app-host/hot-reload-and-watch/#recommended-workflow). `-mt` lets the -SDK execute supported build tasks with multithreaded task execution, which can reduce the time it takes for -resources to become ready. - - - -## How project references work - -The C#, TypeScript, and Go AppHosts differ in how they reference .NET projects: - -- **C# AppHost**: A `ProjectReference` marked as an Aspire project resource generates a `Projects.*` type during build. `AddProject("api")` uses that generated type to locate and launch the project. For the build behavior behind this generation step, see [Generated project metadata](/get-started/aspire-sdk/#generated-project-metadata). - -- **TypeScript AppHost**: No `ProjectReference` is needed. `addProject("api", "../ApiService/ApiService.csproj")` points directly to the `.csproj` file. The TypeScript SDK resolves the project path at startup. - -- **Go AppHost**: No `ProjectReference` is needed. `AddDotnetProject("api", "../ApiService/ApiService.csproj")` points directly to the `.csproj` file. -## Exclude a project from orchestration - -In a C# AppHost, if you need a regular project reference that shouldn't become an Aspire resource, set `IsAspireProjectResource="false"` on the `ProjectReference`: - -```xml title="AppHost.csproj" - -``` - -In a TypeScript AppHost, this concept doesn't apply — you only add resources you explicitly call `addProject` on, so simply omit the `addProject` call. - -## Customize generated project type names - -In a C# AppHost, if multiple projects would generate the same `Projects.*` type name, set `AspireProjectMetadataTypeName` on the `ProjectReference`: - -```xml title="AppHost.csproj" - - - - + project.ExcludeLaunchProfile = true; + project.ExcludeKestrelEndpoints = false; +}); ``` -Then reference those generated types explicitly: - - - -```csharp title="AppHost.cs" -var builder = DistributedApplication.CreateBuilder(args); - -var microservice1 = builder.AddProject("micro1"); -var microservice2 = builder.AddProject("micro2"); - -builder.Build().Run(); -``` -The TypeScript AppHost doesn't use generated project types. Use the `.csproj` path directly for each project — name collisions don't apply: ```typescript title="apphost.mts" -import { createBuilder } from './.aspire/modules/aspire.mjs'; - -const builder = await createBuilder(); - -const microservice1 = await builder.addProject("micro1", "../Microservice1/Presentation.Api/Presentation.Api.csproj"); -const microservice2 = await builder.addProject("micro2", "../Microservice2/Presentation.Api/Presentation.Api.csproj"); - -await builder.build().run(); +await builder.addProject("inventoryservice", "../InventoryService/InventoryService.csproj", { + launchProfileOrOptions: "https", +}); ``` - - -The Go AppHost doesn't use generated project types either. Use the `.csproj` path directly for each project: -```go title="apphost.go" -micro1 := builder.AddDotnetProject("micro1", "../Microservice1/Presentation.Api/Presentation.Api.csproj") -micro2 := builder.AddDotnetProject("micro2", "../Microservice2/Presentation.Api/Presentation.Api.csproj") -``` -## AddProject vs. AddCSharpApp +`AddDotnetProject` exposes the same choices through `launchProfileName`, `excludeLaunchProfile`, and `excludeKestrelEndpoints` options. See [Configure options](/integrations/frameworks/dotnet/dotnet-host/#configure-options). -:::note -`AddProject` and `AddCSharpApp` are obsolete starting in Aspire 17.0. Use [`AddDotnetProject`](/integrations/frameworks/dotnet/dotnet-host/) from `Aspire.Hosting.Dotnet` for new project or file-based app resources instead. See [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/). -::: +## Customize generated project types -In a **C# AppHost**, use `AddProject` when you have a standard `.csproj`, can add a `ProjectReference` from the AppHost, and want generated `Projects.*` types plus launch-profile integration. Use `AddCSharpApp` when you want to run a single `.cs` file, or when you want to point at a project path directly without adding a `ProjectReference` from the AppHost. +To rename a generated `Projects.*` type, for example when two projects have the same name, set `AspireProjectMetadataTypeName` on the `ProjectReference`. `AddDotnetProject` takes a path, so it doesn't use generated types or this metadata. -In a **TypeScript AppHost**, `addProject(name, path)` always takes a path, so the distinction between `AddProject` and `AddCSharpApp` doesn't apply in the same way. - -Some .NET app types use specialized integrations instead of `AddProject`. For example, [.NET MAUI integration](/integrations/dotnet/maui/) uses because MAUI apps aren't added to the AppHost through `ProjectReference` metadata. - -## Migrate from legacy project resources - -The `aspire-project-v2-migration` skill assesses legacy project resources in C# or TypeScript AppHosts targeting Aspire 13.6 or newer and proposes exact edits for approval. It preserves supported configuration and flags unsupported patterns, including Azure Functions and custom integrations tied to `ProjectResource`. - -The skill doesn't upgrade your AppHost's Aspire version. Upgrade first, then follow [Aspire skills](/get-started/aspire-skills/) to install the migration skill and review its proposal before applying it. + + For the full set of `ProjectReference` metadata, see [Generated project metadata](/get-started/aspire-sdk/#generated-project-metadata). + ## See also -- [C# AppHost project configuration](/get-started/aspire-sdk/) -- [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) +- [Migrate to the new DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/) +- [Set up .NET / C# apps in the AppHost](/integrations/frameworks/dotnet/dotnet-host/) - [Launch profiles](/integrations/dotnet/launch-profiles/) -- [.NET MAUI integration](/integrations/dotnet/maui/) -- [TypeScript AppHost project structure](/app-host/typescript-apphost/) +- [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) +- [.NET MAUI integration](/integrations/dotnet/maui/) \ No newline at end of file diff --git a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx index d0d9c9a809..3bd5273939 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx @@ -266,6 +266,54 @@ builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", aspire.Ad - `excludeLaunchProfile: true` disables launch profiles entirely and takes precedence over a supplied `launchProfileName`. - `excludeKestrelEndpoints: true` stops Aspire from deriving model endpoints from the project's Kestrel configuration. It doesn't rewrite or disable the service's own Kestrel configuration. + + For profile selection order and how `applicationUrl` values become endpoints, see [Launch profiles](/integrations/dotnet/launch-profiles/). + + +## Filter endpoints in environment variables + +By default, Aspire passes a project's endpoints to the process through environment variables such as `ASPNETCORE_URLS` and `HTTP_PORTS`/`HTTPS_PORTS`. Call `WithEndpointsInEnvironment` / `withEndpointsInEnvironment` to control which endpoints are included: + + + + +```csharp title="AppHost.cs" +builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj") + .WithHttpsEndpoint() + .WithHttpsEndpoint(port: 19227, name: "admin") + .WithEndpointsInEnvironment( + filter: static endpoint => endpoint.Name is not "admin"); +``` + + + + +```typescript title="apphost.mts" +await builder.addDotnetProject('apiservice', '../ApiService/ApiService.csproj') + .withHttpsEndpoint() + .withHttpsEndpoint({ port: 19227, name: 'admin' }) + .withEndpointsInEnvironment(['https']); // include only "https" +``` + + + + +```go title="apphost.go" +builder.AddDotnetProject("apiservice", "../ApiService/ApiService.csproj"). + WithHttpsEndpoint(). + WithHttpsEndpoint(aspire.HttpsEndpointPort(19227), aspire.HttpsEndpointName("admin")). + WithEndpointsInEnvironment([]string{"https"}) // include only "https" +``` + + + + +The `admin` endpoint stays in the application model but isn't exposed to the process through environment variables. The C# overload takes a filter callback; TypeScript and Go take the names of the endpoints to include. + + + For ports, proxies, and replicas, see [Inner-loop networking](/fundamentals/networking-overview/). + + ## Launch from an IDE Aspire builds SDK-style project resources before launching them and surfaces any compiler diagnostics. A compile failure stops the resource from launching. You don't need to build each service yourself, whether you start the app with `aspire run` or from an IDE. @@ -278,6 +326,36 @@ IDEs without external build support, such as Visual Studio, still launch project - This build customization isn't supported. Aspire fails to start the application and reports an error instead of launching output that the IDE can't reliably locate. Run the application with `aspire run`, use an IDE with external build support, or remove the build customization. - File-based apps build themselves when they launch. They wait for Aspire to finish building project resources, but they aren't serialized with each other, so separate file-based apps can race when they share `#:project` outputs. `WaitForStart` only waits for the file-based app process to start, not for its build to finish. To avoid races, run with `aspire run`, use an IDE with external build support, or add a health check to the preceding app that passes only after it finishes building and call `WaitFor` on the next app. +## Coordinated builds and restore + +Before resources start, Aspire groups SDK-style projects that share a compatible SDK and build environment into generated MSBuild traversal projects under the AppHost's intermediate output. Build groups run one after another. Projects within a group build in parallel and share one NuGet graph restore, which avoids restoring overlapping dependency graphs repeatedly. Projects that call `WithBuildEnvironment` build separately from these groups. + +Because the group restore doesn't invoke each project's `Restore` target separately, custom targets attached to it, such as `BeforeTargets="Restore"` or `AfterTargets="Restore"`, don't run for each project. If a project relies on those hooks, set `Aspire:Dotnet:RestoreProjectsIndividually` to `true` in the **AppHost's** configuration: + +```json title="appsettings.json" +{ + "Aspire": { + "Dotnet": { + "RestoreProjectsIndividually": true + } + } +} +``` + +The environment-variable equivalent is `Aspire__Dotnet__RestoreProjectsIndividually=true`. The setting defaults to `false` and applies to every generated traversal in the AppHost; it isn't a runtime environment variable for your resources. With individual restore, each project restores one at a time while builds remain parallel. + +A traversal also restores projects individually when its MSBuild context enables `RestoreUseStaticGraphEvaluation`, because NuGet's static restore requires a restore-capable entry project. The build resource's logs report why individual restore was selected. Restore failures aren't retried with the other strategy. + +File-based apps, projects with a custom build environment, individual **Rebuild** commands, and publishing use their own build and restore paths. + +### Multithreaded builds + +When the `dotnet` SDK selected for a build (honoring `global.json`) supports the MSBuild `-mt` switch, Aspire passes it to coordinated traversal builds, file-based app builds, and [rebuild commands](/app-host/hot-reload-and-watch/#recommended-workflow). Multithreaded task execution can reduce the time it takes for resources to become ready. No configuration is required. + +:::note +Project and traversal builds use `-mt` with .NET SDK `11.0.100-rc.1` or later. File-based app builds require .NET SDK `11.0.100` or later. +::: + ## Publishing Resources created with `AddDotnetProject` are automatically configured for the .NET SDK container-publishing pipeline. Use them with your [deployment target](/deployment/deploy-with-aspire/). diff --git a/src/frontend/src/content/docs/languages-and-runtimes/index.mdx b/src/frontend/src/content/docs/languages-and-runtimes/index.mdx index 58ca9d323d..179993bd94 100644 --- a/src/frontend/src/content/docs/languages-and-runtimes/index.mdx +++ b/src/frontend/src/content/docs/languages-and-runtimes/index.mdx @@ -50,7 +50,7 @@ The sections below use the labels that are most helpful when you're trying to an Use Aspire with C# projects, file-based apps, and other .NET workloads. - Start with [C# file-based apps](/integrations/dotnet/csharp-file-based-apps/) or [Project resources](/integrations/dotnet/project-resources/). To add a C# project or file-based app **by path** without referencing it from the AppHost's solution, use the [.NET / C# integration](/integrations/frameworks/dotnet/dotnet-get-started/). + Start with the [.NET / C# integration](/integrations/frameworks/dotnet/dotnet-get-started/) to add C# projects and [file-based apps](/integrations/dotnet/csharp-file-based-apps/) by path. diff --git a/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx b/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx index 2bf3c8cc42..99977b636a 100644 --- a/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx +++ b/src/frontend/src/content/docs/whats-new/aspire-13-6.mdx @@ -464,7 +464,7 @@ To move an existing AppHost onto this model, the CLI bundles a Project V2 migrat See [coordinated builds and - restore](/integrations/dotnet/project-resources/#coordinated-builds-and-restore). + restore](/integrations/frameworks/dotnet/dotnet-host/#coordinated-builds-and-restore). #### Portable volume paths From c776bf0e11bdc695c24be27a89f4f6e81eb96117 Mon Sep 17 00:00:00 2001 From: Maddy Montaquila Date: Mon, 16 Nov 2026 17:37:44 -0500 Subject: [PATCH 09/12] Update test samples and Japanese code samples to AddDotnetProject - Use CreateResourceBuilder in testing samples (EN + ja) - Drop ProjectResource from resource-model built-in types table - Convert ja code fences from AddProject/addProject/AddCSharpApp to AddDotnetProject; prose left for translators Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../docs/architecture/resource-model.mdx | 3 +- .../docs/ja/app-host/container-files.mdx | 8 +-- .../docs/ja/app-host/container-registry.mdx | 52 +++++++++---------- .../src/content/docs/ja/app-host/eventing.mdx | 4 +- .../docs/ja/app-host/executable-resources.mdx | 4 +- .../app-host/migrate-from-docker-compose.mdx | 20 +++---- .../docs/ja/app-host/resource-lifetimes.mdx | 4 +- .../ja/architecture/resource-hierarchies.mdx | 14 ++--- .../docs/ja/architecture/resource-model.mdx | 4 +- .../content/docs/ja/deployment/pipelines.mdx | 18 +++---- .../ja/extensibility/custom-resources.mdx | 4 +- .../fundamentals/custom-resource-commands.mdx | 16 +++--- .../ja/fundamentals/custom-resource-urls.mdx | 6 +-- .../ja/fundamentals/external-parameters.mdx | 22 ++++---- .../docs/ja/fundamentals/health-checks.mdx | 16 +++--- .../docs/ja/fundamentals/http-commands.mdx | 4 +- .../ja/fundamentals/networking-overview.mdx | 4 +- .../ja/fundamentals/service-discovery.mdx | 28 +++++----- .../get-started/add-aspire-existing-app.mdx | 12 ++--- .../docs/ja/get-started/aspire-mcp-server.mdx | 12 ++--- .../docs/ja/get-started/deploy-first-app.mdx | 8 +-- .../content/docs/ja/get-started/first-app.mdx | 4 +- .../docs/ja/get-started/troubleshooting.mdx | 6 +-- .../docs/ja/get-started/what-is-aspire.mdx | 2 +- .../integrations/dotnet/launch-profiles.mdx | 7 +-- .../docs/ja/testing/write-your-first-test.mdx | 9 ++-- .../docs/testing/write-your-first-test.mdx | 9 ++-- 27 files changed, 153 insertions(+), 147 deletions(-) diff --git a/src/frontend/src/content/docs/architecture/resource-model.mdx b/src/frontend/src/content/docs/architecture/resource-model.mdx index d74b7887ea..ef2263506c 100644 --- a/src/frontend/src/content/docs/architecture/resource-model.mdx +++ b/src/frontend/src/content/docs/architecture/resource-model.mdx @@ -172,10 +172,9 @@ Aspire provides a set of fundamental built-in resource types that serve as the f |----------------------|---------------------------------------------------------| | `ContainerResource` | Runs Docker containers as resources. | | `ExecutableResource` | Launches arbitrary executables or scripts as resources. | -| `ProjectResource` | Runs a .NET project directly (build + launch workflow). | | `ParameterResource` | Represents a parameter or configuration value. | -These types are **infrastructure-oriented primitives**. They model how code and applications are packaged and executed. +These types are **infrastructure-oriented primitives**. They model how code and applications are packaged and executed. Language integrations build on them; for example, `DotnetProjectResource` from `Aspire.Hosting.Dotnet` is an `ExecutableResource` that builds and launches a .NET project.