Aller au contenu
DocumentationEssayer Aspire
DocumentationEssayer

Get started with the .NET / C# app integration

Ce contenu n’est pas encore disponible dans votre langue.

C# logo

The Aspire Aspire.Hosting.Dotnet integration lets you add C# projects and file-based C# apps to your AppHost by path, without referencing a project from the AppHost’s own solution. It’s the C# peer of the Aspire.Hosting.Go, Aspire.Hosting.Python, and Aspire.Hosting.JavaScript hosting integrations.

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 AddProject<T>.

The Dotnet integration is a hosting integration. You install it in the AppHost and use AddDotnetProject / addDotnetProject to add a C# project or file-based app resource by path.

  1. Add the Aspire.Hosting.Dotnet hosting integration to your AppHost, then use AddDotnetProject / addDotnetProject to model a C# project or file-based app resource by path. The host reference covers package installation, path resolution, and launch behavior.

    Set up .NET / C# apps in the AppHost