Skip to main content
.NETStandard2.0

Analyzers for Aspire hosting integration authors.

Published
Sep 29, 2026
23d ago
Total Downloads
5.6K
5,645

Install

dotnet add package Aspire.Hosting.Integration.Analyzers --version 13.6.0-preview.1.26479.8
ProductVersions
.NET Standard
netstandard2.0

README

Aspire.Hosting.Integration.Analyzers package

Provides Roslyn analyzers for Aspire hosting integration authors building ATS and polyglot-friendly extensions outside the Aspire repo.

Getting started

Install the package

In your integration project, install the analyzer package with NuGet:

dotnet add package Aspire.Hosting.Integration.Analyzers --prerelease

If you edit the project file directly, keep the analyzer private and use the same package version as the Aspire packages referenced by the integration:

<ItemGroup>
  <PackageReference Include="Aspire.Hosting.Integration.Analyzers" Version="<Aspire package version>" PrivateAssets="all" />
</ItemGroup>

Usage

The package is applied automatically when it is referenced. No additional MSBuild property is required.

Integrations that run these analyzers are treated as polyglot-compatible by default and automatically get the polyglot NuGet tag so aspire add can surface the integration to non-C# (TypeScript, Python, Go, Java, Rust) AppHosts. A project that is not a polyglot integration (for example, infrastructure that has no [AspireExport] surface) must acknowledge that by setting the following property:

<PropertyGroup>
  <IsAspirePolyglotCompatible>false</IsAspirePolyglotCompatible>
</PropertyGroup>

Setting the property to false omits the polyglot NuGet tag. If a project has no [AspireExport] coverage and does not opt out, the build fails with ASPIREEXPORT017, prompting you to either add export coverage or opt out.

The analyzers validate common ATS export patterns used by polyglot integrations, such as:

  • exported builder methods that directly invoke synchronous callbacks
  • unsupported signatures or exported shapes for ATS/code-generated hosting surfaces
  • other authoring patterns that can break polyglot consumers

For example, this pattern produces analyzer feedback because the exported API executes a synchronous callback directly:

using Aspire.Hosting;
using Aspire.Hosting.ApplicationModel;

namespace MyIntegration;

public static class MyIntegrationExtensions
{
    [AspireExport("addMyContainer")]
    public static IResourceBuilder<ContainerResource> AddMyContainer(
        this IDistributedApplicationBuilder builder,
        string name,
        Action<IResourceBuilder<ContainerResource>> configure)
    {
        var resource = builder.AddContainer(name, "my-image");
        configure(resource);
        return resource;
    }
}

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

Changes from Previous Version

No structural changes between v13.5.4-preview.1.26464.4 and v13.6.0-preview.1.26479.8.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.