Skip to main content
.NETStandard2.0

Analyzers for Aspire hosting integration authors.

Published
Jun 3, 2026
4mo ago
Total Downloads
5.6K
5,645

Install

dotnet add package Aspire.Hosting.Integration.Analyzers --version 13.4.1-preview.1.26303.3
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.

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.4.0-preview.1.26281.18 and v13.4.1-preview.1.26303.3.

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.