### Install and Connect in Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/messaging/nats/nats-connect.mdx Install the nats.go client and connect to NATS using the NATS_URI environment variable. This example shows basic connection setup. ```bash go get github.com/nats-io/nats.go ``` ```go package main import ( "os" "github.com/nats-io/nats.go" ) func main() { // Read the Aspire-injected connection URI natsURI := os.Getenv("NATS_URI") nc, err := nats.Connect(natsURI) if err != nil { panic(err) } defer nc.Close() // Use nc to publish and subscribe... } ``` -------------------------------- ### Install Qdrant Go Client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-connect.mdx Install the official Go client for Qdrant using the go get command. ```bash go get github.com/qdrant/go-client ``` -------------------------------- ### Install Milvus Go SDK Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/milvus/milvus-connect.mdx Install the official Milvus Go SDK using `go get`. ```bash go get github.com/milvus-io/milvus-sdk-go/v2 ``` -------------------------------- ### Start JavaScript frontend with npm Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/what-is-aspire.mdx Navigates to the frontend directory and starts the development server using npm. Ensure Node.js and npm are installed. ```bash cd frontend && npm run dev ``` -------------------------------- ### Install RavenDB Go Client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-connect.mdx Install the ravendb-go-client library using go get. ```bash go get github.com/ravendb/ravendb-go-client ``` -------------------------------- ### Install RabbitMQ Go Client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-connect.mdx Install the official Go client for AMQP 0-9-1 using `go get`. ```bash go get github.com/rabbitmq/amqp091-go ``` -------------------------------- ### Install All Skills and Companion Options Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/reference/cli/commands/aspire-agent-init.mdx Installs all available skills and companion options across all supported skill locations. This is a comprehensive setup for agent initialization. ```bash aspire agent init --skills all --skill-locations all ``` -------------------------------- ### Install Ollama Go library Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/ai/ollama/ollama-connect.mdx Install the official Ollama Go library using go get. ```bash go get github.com/ollama/ollama/api ``` -------------------------------- ### Install and Connect to Elasticsearch in Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-connect.mdx Install the go-elasticsearch client and connect by reading the ELASTICSEARCH_URI environment variable. This example demonstrates fetching cluster info. ```bash go get github.com/elastic/go-elasticsearch/v8 ``` ```go package main import ( "os" elasticsearch8 "github.com/elastic/go-elasticsearch/v8" ) func main() { // Read the Aspire-injected connection URI cfg := elasticsearch8.Config{ Addresses: []string{os.Getenv("ELASTICSEARCH_URI")}, } es, err := elasticsearch8.NewClient(cfg) if err != nil { panic(err) } res, err := es.Info() if err != nil { panic(err) } defer res.Body.Close() } ``` -------------------------------- ### Install KurrentDB Go Client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/kurrentdb/kurrentdb-connect.mdx Install the official KurrentDB Go client using the go get command. ```bash go get github.com/kurrent-io/KurrentDB-Client-Go/kurrentdb ``` -------------------------------- ### Install and Connect in TypeScript Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/messaging/nats/nats-connect.mdx Install the nats package and connect to NATS using the NATS_URI environment variable. This example demonstrates basic connection setup. ```bash npm install nats ``` ```typescript import { connect } from 'nats'; // Read the Aspire-injected connection URI const nc = await connect({ servers: process.env.NATS_URI, }); // Use nc to publish and subscribe... await nc.drain(); ``` -------------------------------- ### Install pgx driver for Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/postgres/postgres-connect.mdx Install the pgx driver, the recommended PostgreSQL driver for Go, using go get. ```bash go get github.com/jackc/pgx/v5 ``` -------------------------------- ### Single-File AppHost Example Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/whats-new/aspire-13.mdx Demonstrates a single-file AppHost setup in Aspire 13.0, which does not require a project file. Package references are declared using `#:package` directives. ```csharp // apphost.cs #:sdk Aspire.AppHost.Sdk@13.0.0 #:package Aspire.Hosting.Redis@13.0.0 var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache"); var api = builder.AddProject("apiservice", "../MyApi") .WithReference(cache); builder.Build().Run(); ``` -------------------------------- ### Install confluent-kafka-go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-connect.mdx Install the official Go client for Apache Kafka using `go get`. ```bash go get github.com/confluentinc/confluent-kafka-go/v2/kafka ``` -------------------------------- ### Install Meilisearch Go client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-connect.mdx Install the official Meilisearch Go client using the go get command. ```bash go get github.com/meilisearch/meilisearch-go ``` -------------------------------- ### Install and Connect in Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/ai/github-models/github-models-connect.mdx Install the go-openai package and connect to GitHub Models by reading environment variables for API key, endpoint, and model name. This example uses the OpenAI-compatible API. ```bash go get github.com/sashabaranov/go-openai ``` ```go package main import ( "context" "fmt" "os" openai "github.com/sashabaranov/go-openai" ) func main() { // Read the Aspire-injected connection properties apiKey := os.Getenv("CHAT_KEY") endpoint := os.Getenv("CHAT_ENDPOINT") modelName := os.Getenv("CHAT_MODELNAME") config := openai.DefaultConfig(apiKey) config.BaseURL = endpoint client := openai.NewClientWithConfig(config) resp, err := client.CreateChatCompletion( context.Background(), openai.ChatCompletionRequest{ Model: modelName, Messages: []openai.ChatCompletionMessage{ {Role: openai.ChatMessageRoleUser, Content: "Hello!"}, }, }, ) if err != nil { panic(err) } fmt.Println(resp.Choices[0].Message.Content) } ``` -------------------------------- ### Install Azure SDK for Go packages Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-connect.mdx Install the necessary Azure SDK for Go packages for OpenAI client and identity management using `go get`. ```bash go get github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` -------------------------------- ### Setup .NET Environment in GitHub Actions Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/deployment/app-lifecycle.mdx Installs the .NET SDK required for C# AppHost projects. Ensure the version matches your project's requirements. ```yaml - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: '10.0.x' ``` -------------------------------- ### Example Aspire CLI version output Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/install-cli.mdx This is an example of the output you should see after successfully running the `aspire --version` command, indicating the installed version. ```bash 13.4.0+{commitSHA} ``` -------------------------------- ### Install and Connect to Elasticsearch in Python Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-connect.mdx Install the elasticsearch-py client and connect using the ELASTICSEARCH_URI environment variable. This example pings the Elasticsearch instance. ```bash pip install elasticsearch ``` ```python import os from elasticsearch import Elasticsearch # Read the Aspire-injected connection URI es = Elasticsearch(os.getenv("ELASTICSEARCH_URI")) # Use client to interact with Elasticsearch... response = es.ping() print(f"Elasticsearch connection status: {response}") ``` -------------------------------- ### Initialize Aspire support Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/reference/cli/commands/aspire-init.mdx Run the aspire init command to start the interactive setup for Aspire support in your project. ```bash aspire init [options] ``` -------------------------------- ### Start the AppHost with a specific environment Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/reference/cli/commands/aspire-start.mdx Specify the environment to use when starting the AppHost with the `--environment` option. For example, 'Development'. ```bash aspire start --environment Development ``` -------------------------------- ### Install flagd Go Provider Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/devtools/flagd/flagd-connect.mdx Install the necessary OpenFeature Go SDK and flagd provider packages using go get. ```bash go get github.com/open-feature/go-sdk/openfeature go get github.com/open-feature/go-sdk-contrib/providers/flagd/pkg ``` -------------------------------- ### Install and Connect in Python Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/messaging/nats/nats-connect.mdx Install the nats-py client and connect to NATS using the NATS_URI environment variable. This example uses asyncio for asynchronous operations. ```bash pip install nats-py ``` ```python import asyncio import os import nats async def main(): # Read the Aspire-injected connection URI nats_uri = os.getenv("NATS_URI") nc = await nats.connect(nats_uri) # Use nc to publish and subscribe... await nc.close() asyncio.run(main()) ``` -------------------------------- ### Start AppHost with Arguments Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/reference/cli/commands/aspire-start.mdx Starts the AppHost and passes subsequent arguments directly to the application. Use the `--` delimiter to separate arguments for `aspire start` from arguments intended for the AppHost. ```bash aspire start -- --arg1 value1 --arg2 value2 ``` -------------------------------- ### Example launchSettings.json Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx A sample launchSettings.json file showing different profiles with command names, application URLs, and environment variables. ```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" } } } } ``` -------------------------------- ### Create an Aspire Starter App (ASP.NET Core/Blazor) with Aspire CLI Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/aspire-sdk-templates.mdx Creates a full Aspire starter application with a sample UI and API using the Aspire CLI. ```bash aspire new aspire-starter ``` -------------------------------- ### Create an Aspire Starter App (ASP.NET Core and React) with Aspire CLI Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/aspire-sdk-templates.mdx Creates an Aspire starter application with ASP.NET Core and React using the Aspire CLI. ```bash aspire new aspire-ts-cs-starter ``` -------------------------------- ### Azure Provisioning Output Example Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/local-provisioning.mdx Observe the console output during `aspire run` to see the progress of Azure resource provisioning, including resource group creation and deployment status. ```txt [Azure Provisioning] Creating resource group: rg-myapp [Azure Provisioning] Deploying storage account: stmyapp [Azure Provisioning] Deployment complete ``` -------------------------------- ### Install MongoDB Go Driver Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-connect.mdx Install the official MongoDB Go driver using the go get command. ```bash go get go.mongodb.org/mongo-driver/v2/mongo ``` -------------------------------- ### Install Valkey Hosting Integration (C# Project File) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx Add the `Aspire.Hosting.Valkey` NuGet package reference to your C# project file for manual installation. ```xml ``` -------------------------------- ### Install Go Host Package (C# Project File) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx Manually add the `Aspire.Hosting.Go` package reference to your AppHost project's `.csproj` file. ```xml ``` -------------------------------- ### Create an Aspire Starter App (FastAPI and React) with Aspire CLI Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/aspire-sdk-templates.mdx Creates an Aspire starter application with FastAPI and React using the Aspire CLI. ```bash aspire new aspire-py-starter ``` -------------------------------- ### Run Aspire with Automatic SDK Installation Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/whats-new/aspire-13.mdx When automatic .NET SDK installation is enabled, the 'aspire run' command will install required SDKs if they are missing before starting the application. ```bash # With the feature enabled, the CLI will automatically install the required SDK aspire run # Installing .NET SDK 10.0.100... # ✅ SDK installation complete # Running app host... ``` -------------------------------- ### Configure AppHost Resources in Program.cs (.NET) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx Wire up your services, databases, and caches in the AppHost's Program.cs file. This example shows how to add Redis and PostgreSQL, reference projects, and set up dependencies. ```csharp var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedis("cache") .WithLifetime(ContainerLifetime.Persistent); var db = builder.AddPostgres("postgres") .WithLifetime(ContainerLifetime.Persistent) .AddDatabase("mydb"); var api = builder.AddProject("api") .WithReference(db) .WithReference(cache) .WaitFor(db); builder.AddProject("web") .WithReference(api) .WaitFor(api); builder.AddProject("worker") .WithReference(cache) .WithReference(db); builder.Build().Run(); ``` -------------------------------- ### Install go-sql-driver/mysql for Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/mysql/mysql-connect.mdx Install the go-sql-driver/mysql package, the most widely used MySQL driver for Go, using the go get command. ```bash go get github.com/go-sql-driver/mysql ``` -------------------------------- ### Basic AppHost setup in C# Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/fundamentals/persist-data-volumes.mdx This is a basic setup for an AppHost project in C#. It initializes the distributed application builder. Consider adding volume and persistent password configurations. ```csharp var builder = DistributedApplication.CreateBuilder(args); // TODO: // Consider various code snippets for configuring // volumes here and persistent passwords. builder.Build().Run(); ``` -------------------------------- ### Install Cert-Manager and Podinfo Helm Charts on Kubernetes (TypeScript) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/deployment/kubernetes/helm-charts.mdx This TypeScript example illustrates installing cert-manager and a podinfo Helm chart on a Kubernetes environment. It configures Helm values, namespaces, and destruction behavior for each chart, mirroring the C# example's functionality. ```typescript import { createBuilder } from './.aspire/modules/aspire.mjs'; const builder = await createBuilder(); const k8s = await builder.addKubernetesEnvironment('k8s'); // cert-manager is a cluster-wide tool — don't uninstall it when the app is destroyed const certManager = await k8s.addHelmChart( 'cert-manager', 'oci://quay.io/jetstack/charts/cert-manager', '1.17.0' ); await certManager.withHelmValue('crds.enabled', 'true'); // podinfo is specific to this app — uninstall it on destroy const podinfo = await k8s.addHelmChart( 'podinfo', 'oci://ghcr.io/stefanprodan/charts/podinfo', '6.7.1' ); await podinfo.withHelmChartNamespace('podinfo'); await podinfo.withHelmValue('replicaCount', '2'); await podinfo.withHelmChartDestroy(); const api = await builder.addProject('api', '../MyApi/MyApi.csproj'); await builder.build().run(); ``` -------------------------------- ### Install Individual Perl Module with cpanm Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/perl.mdx Use `.WithCpanMinus().WithPackage()` to install individual Perl modules by name before the application starts. The module is installed into a local directory, and `PERL5LIB` is updated to include it. ```csharp builder.AddPerlScript("worker", "../scripts", "Worker.pl") .WithCpanMinus() .WithPackage("OpenTelemetry::SDK", skipTest: true) .WithLocalLib("local"); ``` -------------------------------- ### Install Azure Web PubSub SDK for Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-connect.mdx Install the necessary Azure Web PubSub and identity SDKs for Go. ```bash go get github.com/Azure/azure-sdk-for-go/sdk/messaging/webpubsub go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` -------------------------------- ### Start Optional Resource Manually in Test Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/testing/advanced-scenarios.mdx In integration tests, you can choose to start resources marked with `WithExplicitStart` manually or leave them stopped. This example shows starting the application without the 'monitoring' resource. ```csharp await using var app = await appHost.BuildAsync(); await app.StartAsync(); // The "monitoring" resource is not started—only "api" is running using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); await app.ResourceNotifications.WaitForResourceHealthyAsync("api", cts.Token); using var httpClient = app.CreateHttpClient("api"); using var response = await httpClient.GetAsync("/health"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); ``` -------------------------------- ### Install Valkey Hosting Integration (C#) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx Manually install the Valkey hosting integration by adding the `Aspire.Hosting.Valkey` NuGet package to your C# project. ```csharp #:package Aspire.Hosting.Valkey@* ``` -------------------------------- ### Create Go Starter App Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx Generate a new Go starter application using the Aspire CLI after enabling the Go polyglot feature. ```bash aspire new aspire-go-starter ``` -------------------------------- ### Start PostgreSQL container with Docker Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/what-is-aspire.mdx This command starts a PostgreSQL container in detached mode, exposing port 5432. It requires Docker to be installed and running. ```bash docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=secret postgres:15 ``` -------------------------------- ### Initialize npm project Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/dashboard/standalone-for-nodejs.mdx Initializes a new Node.js project with default settings using npm. ```bash npm init -y ``` -------------------------------- ### Install go-redis client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/caching/valkey/valkey-connect.mdx Install the go-redis client for Go applications. This is a prerequisite for connecting to Valkey using the Go client. ```bash go get github.com/redis/go-redis/v9 ``` -------------------------------- ### Install and Connect to Elasticsearch in TypeScript Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-connect.mdx Install the @elastic/elasticsearch Node.js client and connect via the ELASTICSEARCH_URI environment variable. This example pings the Elasticsearch instance. ```bash npm install @elastic/elasticsearch ``` ```typescript import { Client } from '@elastic/elasticsearch'; // Read the Aspire-injected connection URI const client = new Client({ node: process.env.ELASTICSEARCH_URI, }); // Use client to interact with Elasticsearch... const response = await client.ping(); console.log('Elasticsearch connection status:', response); ``` -------------------------------- ### Complete AppHost Example with All MAUI Configurations Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/dotnet/maui.mdx A comprehensive AppHost example demonstrating configurations for Windows, Mac Catalyst, iOS Simulator, and Android Emulator, including Dev Tunnels. ```csharp var builder = DistributedApplication.CreateBuilder(args); var weatherApi = builder.AddProject("webapi"); var publicDevTunnel = builder.AddDevTunnel("devtunnel-public") .WithAnonymousAccess() .WithReference(weatherApi.GetEndpoint("https")); var mauiapp = builder.AddMauiProject("mauiapp", "../YourMauiApp/YourMauiApp.csproj"); mauiapp.AddWindowsDevice() .WithReference(weatherApi); mauiapp.AddMacCatalystDevice() .WithReference(weatherApi); mauiapp.AddiOSSimulator() .WithOtlpDevTunnel() .WithReference(weatherApi, publicDevTunnel); mauiapp.AddAndroidEmulator() .WithOtlpDevTunnel() .WithReference(weatherApi, publicDevTunnel); builder.Build().Run(); ``` -------------------------------- ### Install SurrealDB Go Driver Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-connect.mdx Installs the official SurrealDB Go driver using the go get command. This is a prerequisite for connecting to SurrealDB in Go. ```bash go get github.com/surrealdb/surrealdb.go ``` -------------------------------- ### Example Output for Deploying ASP.NET Core/Blazor App Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/deploy-first-app.mdx This output shows the detailed steps and progress of deploying an ASP.NET Core/Blazor application to Azure App Containers, including build, push, and provisioning stages. ```bash 09:19:34 (pipeline execution) → Starting pipeline execution... 09:19:34 (deploy-prereq) → Starting deploy-prereq... 09:19:34 (build-prereq) → Starting build-prereq... 09:19:34 (build-prereq) ✓ build-prereq completed successfully 09:19:34 (deploy-prereq) i [INF] Initializing deployment for environment 'Production' 09:19:34 (deploy-prereq) i [INF] Deployment state will be loaded from: %USERPROFILE%\.aspire\deployments\{AppHost:Sha}\production.json 09:19:34 (deploy-prereq) i [INF] Setting default deploy tag 'aspire-deploy-20251110151934' for compute resource(s). 09:19:34 (deploy-prereq) ✓ deploy-prereq completed successfully 09:19:34 (validate-azure-login) → Starting validate-azure-login... 09:19:34 (build-webfrontend) → Starting build-webfrontend... 09:19:34 (build-apiservice) → Starting build-apiservice... 09:19:34 (build-apiservice) i [INF] Building container image for resource apiservice 09:19:34 (build-webfrontend) i [INF] Building container image for resource webfrontend 09:19:34 (build-apiservice) i [INF] Building image: apiservice 09:19:36 (validate-azure-login) ✓ Azure CLI authentication validated successfully 09:19:36 (create-provisioning-context) → Starting create-provisioning-context... 09:19:36 (create-provisioning-context) i [INF] Using AzureCliCredential for provisioning. 09:19:38 (create-provisioning-context) i [INF] Default subscription: {SUB_NAME} subscription (/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) 09:19:38 (create-provisioning-context) i [INF] Tenant: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 09:19:38 (create-provisioning-context) i [INF] Using existing resource group pinesharp-rg. 09:19:39 (create-provisioning-context) ✓ create-provisioning-context completed successfully 09:19:39 (provision-env) → Starting provision-env... 09:19:39 (provision-env) → Deploying env 09:19:39 (provision-env) ✓ Using existing deployment for env (0.1s) 09:19:39 (provision-env) ✓ provision-env completed successfully 09:19:39 (login-to-acr-env) → Starting login-to-acr-env... 09:19:39 (login-to-acr-env) → Logging in to envacrdwu3vj6ylvngg 09:19:41 (login-to-acr-env) i [INF] Start processing HTTP request POST https://envacrdwu3vj6ylvngg.azurecr.io/oauth2/exchange 09:19:41 (login-to-acr-env) i [INF] Sending HTTP request POST https://envacrdwu3vj6ylvngg.azurecr.io/oauth2/exchange 09:19:41 (login-to-acr-env) i [INF] Received HTTP response headers after 224.2336ms - 200 09:19:41 (login-to-acr-env) i [INF] End processing HTTP request after 234.3842ms - 200 09:19:43 (login-to-acr-env) i [INF] Docker login to envacrdwu3vj6ylvngg.azurecr.io succeeded. 09:19:43 (login-to-acr-env) ✓ Successfully logged in to envacrdwu3vj6ylvngg.azurecr.io (3.5s) 09:19:43 (login-to-acr-env) ✓ login-to-acr-env completed successfully 09:19:44 (build-apiservice) i [INF] Building image for apiservice completed 09:19:44 (build-webfrontend) i [INF] Building image: webfrontend 09:19:44 (build-apiservice) ✓ build-apiservice completed successfully 09:19:44 (push-apiservice) → Starting push-apiservice... 09:19:44 (push-apiservice) → Pushing apiservice to envacrdwu3vj6ylvngg 09:19:45 (push-apiservice) i [INF] Docker tag for apiservice -> envacrdwu3vj6ylvngg.azurecr.io/apiservice:aspire-deploy-20251110151934 succeeded. 09:19:54 (build-webfrontend) i [INF] Building image for webfrontend completed 09:19:54 (build-webfrontend) ✓ build-webfrontend completed successfully 09:19:54 (push-webfrontend) → Starting push-webfrontend... 09:19:54 (push-webfrontend) → Pushing webfrontend to envacrdwu3vj6ylvngg 09:19:55 (push-webfrontend) i [INF] Docker tag for webfrontend -> envacrdwu3vj6ylvngg.azurecr.io/webfrontend:aspire-deploy-20251110151934 succeeded. 09:21:04 (push-apiservice) i [INF] Docker push for envacrdwu3vj6ylvngg.azurecr.io/apiservice:aspire-deploy-20251110151934 succeeded. 09:21:04 (push-apiservice) ✓ Successfully pushed apiservice to envacrdwu3vj6ylvngg.azurecr.io/apiservice:aspire-deploy-20251110151934 (79.7s) 09:21:04 (push-apiservice) ✓ push-apiservice completed successfully 09:21:04 (provision-apiservice-containerapp) → Starting provision-apiservice-containerapp... ``` -------------------------------- ### Install Elasticsearch NuGet Package Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx Use the `aspire add` command to install the Elasticsearch NuGet package for your project. This command simplifies the setup process. ```bash aspire add elasticsearch ``` -------------------------------- ### Install Node.js packages with Yarn Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/nodejs-extensions.mdx Use `WithYarnPackageInstallation` to automatically install Node.js packages using Yarn before the application starts. This ensures all project dependencies are available. ```csharp var builder = DistributedApplication.CreateBuilder(args); var yarnApp = builder.AddYarnApp("yarn-demo") .WithYarnPackageInstallation(); builder.Build().Run(); ``` -------------------------------- ### Start Aspire application Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/dashboard/ai-coding-agents.mdx Initiates the application startup process using the Aspire CLI. ```bash aspire start ``` -------------------------------- ### Install Node.js packages with npm Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/nodejs-extensions.mdx Use `WithNpmPackageInstallation` to automatically install npm packages before starting the Node.js application. This is analogous to restoring NuGet packages for C# projects. ```csharp var builder = DistributedApplication.CreateBuilder(args); var nodeApp = builder.AddNodeApp("node-demo", "server.js") .WithNpmPackageInstallation(); builder.Build().Run(); ``` -------------------------------- ### Install go-openai client Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/ai/openai/openai-connect.mdx Installs the go-openai library, the most widely used OpenAI client for Go. ```bash go get github.com/sashabaranov/go-openai ``` -------------------------------- ### TypeScript Compile Error Example Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/app-host/typescript-apphost.mdx Example of a TypeScript compile error that will prevent the AppHost from starting. The Aspire CLI runs `tsc --noEmit` to catch these errors. ```text apphost.mts(22,7): error TS2322: Type 'string' is not assignable to type 'number'. ``` -------------------------------- ### Install Node.js packages with pnpm Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/nodejs-extensions.mdx Use `WithPnpmPackageInstallation` to automatically install Node.js packages using pnpm before the application starts. This is useful for projects that prefer pnpm as their package manager. ```csharp var builder = DistributedApplication.CreateBuilder(args); var pnpmApp = builder.AddPnpmApp("pnpm-demo") .WithPnpmPackageInstallation(); builder.Build().Run(); ``` -------------------------------- ### Install and Connect in TypeScript Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/ai/github-models/github-models-connect.mdx Install the openai npm package and connect to GitHub Models using environment variables for API key and base URL. This example uses the OpenAI-compatible API. ```bash npm install openai ``` ```typescript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.CHAT_KEY, baseURL: process.env.CHAT_ENDPOINT, }); const modelName = process.env.CHAT_MODELNAME ?? 'openai/gpt-4o-mini'; const response = await client.chat.completions.create({ model: modelName, messages: [{ role: 'user', content: 'Hello!' }], }); console.log(response.choices[0].message.content); ``` -------------------------------- ### Create a Single-file AppHost Project Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/whats-new/aspire-9-5.mdx Create a new, blank file-based AppHost using the `aspire new` command and selecting the experimental single-file AppHost option. ```csharp #:sdk Aspire.AppHost.Sdk@9.5.2 var builder = DistributedApplication.CreateBuilder(args); builder.Build().Run(); ``` -------------------------------- ### Install and Connect with azure-ai-inference in Python Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/ai/github-models/github-models-connect.mdx Install the azure-ai-inference package and connect to GitHub Models using environment variables for endpoint and API key. This example uses the Azure Key Credential. ```bash pip install azure-ai-inference ``` ```python import os from azure.ai.inference import ChatCompletionsClient from azure.ai.inference.models import SystemMessage, UserMessage from azure.core.credentials import AzureKeyCredential client = ChatCompletionsClient( endpoint=os.environ["CHAT_ENDPOINT"], credential=AzureKeyCredential(os.environ["CHAT_KEY"]), ) model_name = os.environ["CHAT_MODELNAME"] response = client.complete( messages=[UserMessage(content="Hello!")], model=model_name, ) print(response.choices[0].message.content) ``` -------------------------------- ### Initialize New Aspire Solution Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/whats-new/aspire-13.mdx Use the `aspire init` command for an interactive experience to set up new Aspire solutions, including project configuration and service defaults. ```bash # Initialize a new Aspire solution - interactive prompts guide you through setup aspire init ``` -------------------------------- ### Install and Connect with openai package in Python Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/ai/github-models/github-models-connect.mdx Install the openai package and connect to GitHub Models using environment variables for API key and endpoint. This example utilizes the OpenAI-compatible API. ```bash pip install openai ``` ```python import os from openai import OpenAI client = OpenAI( api_key=os.environ["CHAT_KEY"], base_url=os.environ["CHAT_ENDPOINT"], ) model_name = os.environ["CHAT_MODELNAME"] response = client.chat.completions.create( model=model_name, messages=[{"role": "user", "content": "Hello!"}], ) print(response.choices[0].message.content) ``` -------------------------------- ### Install Go Host Package (C#) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx Alternatively, manually install the `Aspire.Hosting.Go` NuGet package in your C# AppHost project. ```csharp #:package Aspire.Hosting.Go@* ``` -------------------------------- ### Retrieve ExampleDbContext from Dependency Injection Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/efcore/sql-server/sql-server-connect.mdx Demonstrates how to inject and use the `ExampleDbContext` object within a service once it has been registered with the dependency injection container. ```csharp public class ExampleService(ExampleDbContext context) { // Use context... } ``` -------------------------------- ### Basic Dapr Setup in Dev Container Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/dev-containers.mdx Configure a Dev Container for basic Dapr integration. This includes installing Dapr CLI and initializing Dapr. Use this for simple Dapr setups. ```json { "name": "Aspire with Dapr", "image": "mcr.microsoft.com/devcontainers/dotnet:dev-10.0-noble", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": { "enableNonRootDocker": true }, "ghcr.io/dapr/cli/dapr-cli:0": {} }, "onCreateCommand": "curl -sSL https://aspire.dev/install.sh | bash", "postCreateCommand": "dotnet dev-certs https --trust && dapr init", "customizations": { "vscode": { "extensions": ["ms-dotnettools.csdevkit", "ms-azuretools.vscode-dapr"] } } } ``` -------------------------------- ### Install Azure Cosmos DB SDK for Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-connect.mdx Install the Azure Cosmos DB SDK for Go using the go get command. This is a prerequisite for connecting to Azure Cosmos DB in Go applications. ```bash go get github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos ``` -------------------------------- ### Create Initial Migration with Package Manager Console Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/efcore/migrations.mdx Use the `Add-Migration` cmdlet in the Package Manager Console to create the first migration. Set the default project to your data project and the startup project to your API/web project. ```powershell Add-Migration InitialCreate ``` -------------------------------- ### Create Aspire App Using Daily Channel Templates Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/reference/cli/commands/aspire-new.mdx Creates a new Aspire starter app using the latest pre-release templates from the 'daily' channel. ```bash aspire new aspire-starter --channel daily ``` -------------------------------- ### C# — ExampleService.cs Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/caching/redis-distributed/redis-distributed-connect.mdx Example of using IDistributedCache to set and get values. ```csharp using Microsoft.Extensions.Caching.Distributed; using System.Text; public class ExampleService(IDistributedCache cache) { public async Task SetAsync(string key, string value, CancellationToken ct = default) { var bytes = Encoding.UTF8.GetBytes(value); await cache.SetAsync(key, bytes, new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) }, ct); } public async Task GetAsync(string key, CancellationToken ct = default) { var bytes = await cache.GetAsync(key, ct); return bytes is null ? null : Encoding.UTF8.GetString(bytes); } } ``` -------------------------------- ### Select Aspire Channel with `aspire new` and `aspire init` Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/whats-new/aspire-13-1.mdx Use the `--channel` option with `aspire new` or `aspire init` to specify the desired Aspire version channel (e.g., `preview`, `stable`). ```bash aspire new aspire-starter --channel preview aspire init --channel stable ``` -------------------------------- ### Example Configuration File Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/fundamentals/external-parameters.mdx Defines a custom configuration structure for reading parameter values. This JSON file demonstrates how to set up nested configuration keys for sensitive information. ```json { "CustomConfig": { "Database": { "Password": "your-secure-password" } } } ``` -------------------------------- ### Install Azure SignalR Service Integration via CLI Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/azure-signalr/azure-signalr-host.mdx Use the `aspire add` command to install the Azure SignalR Service hosting integration. This command simplifies the setup process for integrating Azure SignalR Service into your Aspire application. ```bash aspire add azure-signalr ``` -------------------------------- ### Example aspire.config.json Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/reference/cli/configuration.mdx This is an example of a rooted `aspire.config.json` file, demonstrating the structure for `appHost` path and feature flags. ```json { "$schema": "https://aspire.dev/reference/cli/configuration/schema.json", "appHost": { "path": "./apphost.mts" }, "channel": "staging", "features": { "defaultWatchEnabled": true, "showAllTemplates": true, "updateNotificationsEnabled": true } } ``` -------------------------------- ### Manage user secrets and generated files with AppHost services Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx Use `getUserSecretsManager()` to manage user secrets and `getAspireStore()` for stable files created during AppHost execution. This example shows how to get or set a secret and how to get a file name with content from the store. ```typescript await builder.subscribeBeforeStart(async (event) => { const services = await event.services(); const secrets = services.getUserSecretsManager(); const store = services.getAspireStore(); const model = services.getDistributedApplicationModel(); const api = model.findResourceByName('api'); if (await secrets.isAvailable()) { secrets.getOrSetSecret(api, 'ApiKey', crypto.randomUUID()); } const generatedFile = store.getFileNameWithContent( 'seed-data.json', './seed-data.json' ); }); ``` -------------------------------- ### Install Cert-Manager and Podinfo Helm Charts on Kubernetes (C#) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/deployment/kubernetes/helm-charts.mdx This C# example demonstrates installing both cert-manager and a custom podinfo chart on a Kubernetes environment. It shows how to configure different Helm values and namespaces for each chart, and specifies that cert-manager should not be uninstalled on destroy, while podinfo should be. ```csharp var builder = DistributedApplication.CreateBuilder(args); var k8s = builder.AddKubernetesEnvironment("k8s"); // cert-manager is a cluster-wide tool — don't uninstall it when the app is destroyed k8s.AddHelmChart("cert-manager", "oci://quay.io/jetstack/charts/cert-manager", "1.17.0") .WithHelmValue("crds.enabled", "true"); // podinfo is specific to this app — uninstall it on destroy k8s.AddHelmChart("podinfo", "oci://ghcr.io/stefanprodan/charts/podinfo", "6.7.1") .WithNamespace("podinfo") .WithHelmValue("replicaCount", "2") .WithDestroy(); var api = builder.AddProject("api"); builder.Build().Run(); ``` -------------------------------- ### Start C# API service Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/get-started/what-is-aspire.mdx Navigates to the API directory and runs the C# project using the dotnet CLI. Ensure the .NET SDK is installed. ```bash cd api && dotnet run ``` -------------------------------- ### Aspire CLI — Example pipeline step output Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/deployment/pipelines.mdx Example output from the `--list-steps` flag, showing the order of pipeline steps, their dependencies, and associated tags. ```text 1. parameter-prompt └─ No dependencies 2. provision-redis-infra ├─ Depends on: parameter-prompt └─ Tags: provision-infra 3. build-webapi ├─ Depends on: parameter-prompt └─ Tags: build-compute 4. deploy-webapi ├─ Depends on: provision-redis-infra, build-webapi └─ Tags: deploy-compute ``` -------------------------------- ### Clone Sample App Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/efcore/migrations.mdx Use this command to clone the sample application repository from GitHub, which is used throughout the tutorial for demonstrating EF Core migrations. ```bash git clone https://github.com/MicrosoftDocs/aspire-docs-samples/ ``` -------------------------------- ### Publishing state updates Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/extensibility/custom-resources.mdx Use `ResourceNotificationService` to publish state updates for resources. This example shows how to set the resource state to `Running` and record the start time. ```csharp await notification.PublishUpdateAsync(resource, state => state with { State = KnownResourceStates.Running, StartTimeStamp = DateTime.UtcNow }); ``` -------------------------------- ### Install Azure SDK for Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-search/azure-ai-search-connect.mdx Install the necessary Azure SDK packages for Go to interact with Azure AI Search. ```bash go get github.com/Azure/azure-sdk-for-go/sdk/search/azsearch go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` -------------------------------- ### Add ClickHouse NuGet Package Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/databases/clickhouse/clickhouse-host.mdx Installs the Aspire.Hosting.ClickHouse NuGet package using the aspire CLI. This is the recommended way to start building an Aspire app that uses ClickHouse. ```bash aspire add clickhouse ``` -------------------------------- ### Configure per-environment defaults using appsettings.json (C#) Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/deployment/environments.mdx Illustrates how to set default parameter values for different environments using JSON configuration files in a C# AppHost. ```json { "Parameters": { "apiKey": "dev-key-for-local-testing" } } ``` ```json { "Parameters": { "apiKey": "staging-key-value" } } ``` -------------------------------- ### Install Azure SDK for Go Source: https://github.com/microsoft/aspire.dev/blob/main/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-connect.mdx Install the necessary Azure SDK packages for Go to interact with Azure Service Bus and use Azure identity. ```bash go get github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ```