Skip to main content

aspire new

Create a new app from an Aspire starter template.

Usage

aspire new [template] [options]
aspire new [options]  # Interactive template selection

Description

The aspire new command creates a new Aspire application from a starter template. Templates include pre-configured AppHost projects, service projects, and integration examples.

Templates

The following templates are available:
  • aspire-starter - A starter template with a web frontend and API backend
  • aspire-apphost - An empty AppHost project
  • aspire-servicedefaults - A ServiceDefaults project for shared configuration
  • aspire-apphost-singlefile - A single-file AppHost (no project file)

Options

--name
string
The name of the project to createExample: --name MyAspireAppIf not specified, you’ll be prompted to enter a name.
--output
string
The output path for the projectExample: --output ./projects/MyAppIf not specified, defaults to a new directory in the current location.
--source
string
The NuGet source to use for project templatesExample: --source https://api.nuget.org/v3/index.json
--version
string
The version of the project templates to useExample: --version 10.0.0If not specified, uses the latest version from the selected channel.
--channel
string
Channel to use for templates: stable, daily, or staging (when enabled)Example: --channel dailyIf not specified, uses the configured channel or defaults to stable.
--language
string
The programming language for the AppHost: csharp or typescriptExample: --language typescriptIf not specified, you’ll be prompted to choose when multiple languages are available.

Examples

Create a new starter app

aspire new aspire-starter --name MyApp
cd MyApp/MyApp.AppHost
dotnet run
This creates a complete starter application with:
  • An AppHost project for orchestration
  • A web frontend project
  • An API service project
  • A ServiceDefaults project for shared configuration

Create with interactive prompts

aspire new
You’ll be prompted to:
  1. Select a template
  2. Choose a language (if applicable)
  3. Enter a project name
  4. Specify an output directory
  5. Select a template version

Create an empty AppHost

aspire new aspire-apphost --name MyOrchestrator
This creates just an AppHost project without any service projects.

Use a specific version

aspire new aspire-starter --name MyApp --version 10.0.0-preview.1.25067.1

Use the daily channel

aspire new aspire-starter --name MyApp --channel daily

Create a TypeScript AppHost

aspire new aspire-starter --name MyApp --language typescript

Interactive Prompts

Template Selection

If you don’t specify a template, you’ll see:
Select a template:
  > Aspire Starter Application
    Aspire Empty AppHost
    Aspire ServiceDefaults Project

Language Selection

For templates that support multiple languages:
Which language would you like to use?
  > C#
    TypeScript (Node.js)

Project Name

If --name is not provided:
Enter the project name: MyAspireApp
Project names must:
  • Not contain path separators (/ or \)
  • Be between 1-254 characters
  • Not be empty or whitespace only

Output Path

If --output is not provided:
Enter the output path: ./MyAspireApp

Template Version

When multiple versions are available:
# Which version of Aspire do you want to use?

Multiple versions of Aspire are available. If you want to use
the latest stable version choose 10.0.0.

Select a template version:
  > 10.0.0 (nuget.org)
    10.0.0-preview.1.25067.1 (nuget.org)
    daily

Template Structure

aspire-starter

Creates a solution with:
MyApp/
├── MyApp.sln
├── MyApp.AppHost/
│   ├── MyApp.AppHost.csproj
│   └── Program.cs
├── MyApp.ServiceDefaults/
│   ├── MyApp.ServiceDefaults.csproj
│   └── Extensions.cs
├── MyApp.Web/
│   ├── MyApp.Web.csproj
│   └── Program.cs
└── MyApp.ApiService/
    ├── MyApp.ApiService.csproj
    └── Program.cs
The AppHost is pre-configured to orchestrate both the Web and ApiService projects.

aspire-apphost

Creates a minimal AppHost project:
MyApp/
└── MyApp.AppHost/
    ├── MyApp.AppHost.csproj
    ├── Program.cs
    └── appsettings.json

Configuration

Set a default channel to avoid specifying it each time:
aspire config set channel daily
aspire new aspire-starter --name MyApp  # Uses daily channel
Set a default language:
aspire config set language typescript
aspire new aspire-starter --name MyApp  # Creates TypeScript AppHost

Template Installation

Templates are automatically installed when you run aspire new. The CLI:
  1. Resolves the template version based on --version, --channel, or configured defaults
  2. Downloads the Aspire.ProjectTemplates package from NuGet
  3. Installs the templates to your local template cache
  4. Creates the project from the template
You can also manually install templates:
dotnet new install Aspire.ProjectTemplates::10.0.0

See Also

Build docs developers (and LLMs) love