Skip to content

feat(templates): add Orleans application templates - #10646

Merged
ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:rb-docs-orleans-recipes
Aug 19, 2026
Merged

ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:rb-docs-orleans-recipes

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Problem

Orleans documents the core APIs and project setup, but it has no Microsoft-maintained dotnet new templates for the common application layouts requested in #7184. Developers must reproduce a multi-project solution or co-hosted web setup manually, which makes the first successful application harder to repeat consistently.

Solution

Add the Microsoft.Orleans.Templates package with two maintained templates:

  • orleans creates separate grain contracts, grain implementations, silo, and external client projects
  • orleans-web creates an ASP.NET Core application which co-hosts an Orleans silo and calls a grain from an HTTP endpoint

Both templates support .NET 10 and .NET 8, centralize Orleans package versions, expose an Orleans version option, restore generated projects, and start with localhost clustering for development. The first-application and client guides now provide concrete template-driven recipes and link production configuration guidance.

Rationale

Keeping templates in this repository lets the solution build and release them with Orleans while keeping generated code aligned with maintained documentation. The documentation changes complement the how-to index in #10554 without duplicating or modifying its navigation scope.

Fixes #7184
Fixes #7479

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 18, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new Microsoft.Orleans.Templates NuGet package to the Orleans repo, providing Microsoft-maintained dotnet new templates for common Orleans application layouts, and updates the docs to reference these templates as an on-ramp for new apps.

Changes:

  • Add the orleans multi-project solution template (contracts, grains, silo, external client) with centralized package versions and restore post-actions.
  • Add the orleans-web ASP.NET Core co-hosted silo template with a minimal HTTP endpoint calling a grain.
  • Update quickstart/client documentation to include template-based commands alongside existing manual setup guidance.
Show a summary per file
File Description
templates/Microsoft.Orleans.Templates/templates/orleans/README.md Usage/readme for the multi-project orleans template.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.slnx Solution template grouping the generated projects.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Silo/Program.cs Minimal silo host using localhost clustering.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Silo/OrleansApp.Silo.csproj Silo project definition and dependencies.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Grains/OrleansApp.Grains.csproj Grains project definition and dependencies.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Grains/HelloGrain.cs Example grain implementation.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Contracts/OrleansApp.Contracts.csproj Contracts project definition and dependencies.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Contracts/IHelloGrain.cs Example grain interface.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Client/Program.cs Minimal external client which calls the grain.
templates/Microsoft.Orleans.Templates/templates/orleans/OrleansApp.Client/OrleansApp.Client.csproj Client project definition and dependencies.
templates/Microsoft.Orleans.Templates/templates/orleans/Directory.Packages.props Central package management for the orleans template.
templates/Microsoft.Orleans.Templates/templates/orleans/.template.config/template.json Template metadata and parameters (framework, Orleans version, restore).
templates/Microsoft.Orleans.Templates/templates/orleans/.template.config/dotnetcli.host.json CLI parameter mapping for the orleans template.
templates/Microsoft.Orleans.Templates/templates/orleans-web/README.md Usage/readme for the orleans-web template.
templates/Microsoft.Orleans.Templates/templates/orleans-web/Properties/launchSettings.json Launch profile for consistent local URL.
templates/Microsoft.Orleans.Templates/templates/orleans-web/Program.cs Minimal ASP.NET Core app co-hosting a silo and exposing /hello/{name}.
templates/Microsoft.Orleans.Templates/templates/orleans-web/OrleansWebApp.csproj Web project definition and dependencies.
templates/Microsoft.Orleans.Templates/templates/orleans-web/IHelloGrain.cs Example grain interface for the web template.
templates/Microsoft.Orleans.Templates/templates/orleans-web/HelloGrain.cs Example grain implementation for the web template.
templates/Microsoft.Orleans.Templates/templates/orleans-web/Directory.Packages.props Central package management for the orleans-web template.
templates/Microsoft.Orleans.Templates/templates/orleans-web/.template.config/template.json Template metadata and parameters (framework, Orleans version, restore).
templates/Microsoft.Orleans.Templates/templates/orleans-web/.template.config/dotnetcli.host.json CLI parameter mapping for the orleans-web template.
templates/Microsoft.Orleans.Templates/README.md Package-level README describing installation and template usage.
templates/Microsoft.Orleans.Templates/Microsoft.Orleans.Templates.csproj Packable template NuGet project configuration and content inclusion.
Orleans.slnx Adds the templates project to the main solution.
docs/site/src/content/docs/quickstarts/build-your-first-orleans-app.md Adds template-driven “fast path” commands to the first-app tutorial.
docs/site/src/content/docs/host/client.md Adds a template-driven ASP.NET Core co-hosted client example.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 27/27 changed files
  • Comments generated: 2
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings August 18, 2026 14:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 27/27 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Comment thread docs/site/src/content/docs/quickstarts/build-your-first-orleans-app.md Outdated
ReubenBond and others added 3 commits August 18, 2026 16:08
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 18, 2026 23:25
@ReubenBond
ReubenBond force-pushed the rb-docs-orleans-recipes branch from 67e262c to 81ebaa2 Compare August 18, 2026 23:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread docs/site/src/content/docs/quickstarts/build-your-first-orleans-app.md Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 10149d85-00f6-400c-a059-21cf9592e5d6
Copilot AI review requested due to automatic review settings August 19, 2026 01:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

docs/site/src/content/docs/quickstarts/build-your-first-orleans-app.md:42

  • The quickstart states that the tutorial uses localhost clustering and omits durable storage, but this new template callout describes the orleans template using Azurite-backed Azure Storage resources (and it also requires a container runtime). This can confuse readers who expect the template to match the tutorial’s “localhost/no durable storage” setup. Consider explicitly calling out that difference here.
The `Microsoft.Orleans.Templates` package creates this layout and adds an Aspire AppHost that orchestrates the silo, client, and Azurite-backed Azure Storage resources:

```dotnetcli
dotnet new install Microsoft.Orleans.Templates
dotnet new orleans --name OrleansHelloWorld --output OrleansHelloWorld

templates/Microsoft.Orleans.Templates/README.md:35

  • The package README mentions that the orleans template uses Azurite-backed Azure Storage, but it doesn’t mention that running the generated AppHost requires a container runtime so Aspire can start Azurite (as noted in the per-template README). Adding that requirement here would help avoid a confusing first-run failure.
The `orleans` template uses the Aspire Orleans integration to orchestrate the silo, client, and Azurite-backed Azure Table clustering and Azure Blob grain storage. The `orleans-web` template uses localhost clustering for a one-node local development host. See the [Orleans hosting documentation](https://dotnet.github.io/orleans/docs/host/configuration-guide/) for production configuration guidance.
  • Files reviewed: 30/30 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 10149d85-00f6-400c-a059-21cf9592e5d6
Copilot AI review requested due to automatic review settings August 19, 2026 03:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

templates/Microsoft.Orleans.Templates/templates/orleans/Directory.Packages.props:15

  • The template supports --framework net8.0 (see .template.config/template.json), but Directory.Packages.props hard-pins Microsoft.Extensions.Hosting to 10.0.9. That makes the generated output’s package graph independent of the selected target framework and can break restores/compatibility when targeting .NET 8.

Consider pinning Microsoft.Extensions.Hosting to an 8.x version which is compatible with both net8.0 and net10.0 (as used elsewhere in this repo), or making the version conditional on the framework template parameter.

    <PackageVersion Include="Aspire.Hosting.Azure.Storage" Version="$(AspireVersion)" />
    <PackageVersion Include="Aspire.Hosting.Orleans" Version="$(AspireVersion)" />
    <PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.9" />
    <PackageVersion Include="Microsoft.Orleans.Client" Version="$(OrleansVersion)" />
  • Files reviewed: 30/30 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

This was referenced Sep 8, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Orleans template for aspnetcore Orleans Recipes and Templates

2 participants