Skip to content

Create Your First App

Aspire includes tooling to help you create and configure cloud-native apps. The tooling includes useful starter project templates and other features to streamline getting started with Aspire for Visual Studio, Visual Studio Code, and CLI workflows. Assuming you have the prerequisites and Aspire CLI installed, you can create a new Aspire solution.

  1. Create a new Aspire solution:

    Create a new aspire solution
    aspire new aspire-starter -n AspireApp -o AspireApp

    When prompted to choose a template version, use the Up Arrow Up Arrow Up Arrow and Down Arrow Down Arrow Down Arrow keys to navigate the options. Press Return Enter Enter to confirm your selection.

  2. Verify the solution was created successfully. The Aspire CLI creates a new folder named AspireApp in the current directory. This folder contains the solution file and several projects, including:

    • AspireApp.sln
    • DirectoryAspireApp.ApiService
      • DirectoryProperties/
      • appsettings.Development.json
      • appsettings.json
      • AspireApp.ApiService.csproj
      • Program.cs
    • DirectoryAspireApp.AppHost this is your local dev-time orchestrator
      • DirectoryProperties/
      • appsettings.Development.json
      • appsettings.json
      • AspireApp.AppHost.csproj
      • Program.cs
    • DirectoryAspireApp.ServiceDefaults
      • Extensions.cs
      • AspireApp.ServiceDefaults.csproj
    • DirectoryAspireApp.Web
      • DirectoryProperties/
      • Directorywwwroot/
      • appsettings.Development.json
      • appsettings.json
      • AspireApp.Web.csproj
      • Program.cs
      • WeatherApiClient.cs

    This solution structure is based on the Aspire templates. If they’re not installed already, the CLI will install them for you.

  3. Change to the output directory:

    Change directories—stepping into the output directory
    cd ./AspireApp
  4. Run the Aspire app host project:

    Run dev-time orchestration
    aspire run

    When you run this command, the Aspire CLI automatically finds the app host project, builds your solution, and launches dev-time orchestration. Once the dashboard is ready, its URL (with a login token) appears in your console. You’ll also see a live, real-time view of your running resources and their current states.

    Example output of aspire run
    aspire run
    Dashboard:
    📈 https://localhost:17076/login?t=<Your session's access token>
    ╭─────────────┬─────────┬─────────┬────────────────────────╮
    │ Resource │ Type │ State │ Endpoint(s) │
    ├─────────────┼─────────┼─────────┼────────────────────────┤
    │ apiservice │ Project │ Running │ https://localhost:7393 │
    │ │ │ │ http://localhost:5555 │
    │ webfrontend │ Project │ Running │ https://localhost:7214 │
    │ │ │ │ http://localhost:5124 │
    ╰─────────────┴─────────┴─────────┴────────────────────────╯
    Press Ctrl+C to stop the app host and exit.
  5. Explore the running distributed application. From the dashboard, open the HTTPS endpoint from each resource.

    Aspire dashboard Resources page displaying two running resources: apiservice and webfrontend. Both are marked as Running with green check icons. The table lists columns for Name, State, Start time, Source, URLs, and Actions. apiservice uses AspireApp.ApiService.csproj and has URLs https://localhost:7393 and webfrontend uses AspireApp.Web.csproj with URL https://localhost:7214. The interface has a dark theme with navigation options for Resources, Console, Structured, Traces, and Metrics on the left.

  6. Stop the app host and close the dashboard by pressing ⌘+C Control + C Control + C .

    Congratulations! You’ve created your first Aspire app.

Ask & Answer Collaborate Community Discuss Watch