Soenneker.AdaptiveCard.Util 11.0.762

Prefix Reserved
dotnet add package Soenneker.AdaptiveCard.Util --version 11.0.762
                    
NuGet\Install-Package Soenneker.AdaptiveCard.Util -Version 11.0.762
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.AdaptiveCard.Util" Version="11.0.762" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.AdaptiveCard.Util" Version="11.0.762" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.AdaptiveCard.Util" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.AdaptiveCard.Util --version 11.0.762
                    
#r "nuget: Soenneker.AdaptiveCard.Util, 11.0.762"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.AdaptiveCard.Util@11.0.762
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.AdaptiveCard.Util&version=11.0.762
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.AdaptiveCard.Util&version=11.0.762
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.AdaptiveCard.Util

A small builder for creating consistent Adaptive Cards for Microsoft Teams, alerting pipelines, and other Adaptive Card hosts.

It provides two operations:

  • Build creates a title/summary card with optional facts, exception details, and additional text.
  • BuildTable turns the public properties of a list of objects into a header row and data rows.

Both operations add diagnostic footer fields when available: environment, project name, machine name, and an Eastern Time timestamp.

Installation

dotnet add package Soenneker.AdaptiveCard.Util

Registration

Register the builder with the lifetime used by your application:

using Soenneker.AdaptiveCard.Util.Registrars;

builder.Services.AddAdaptiveCardUtilAsSingleton();

Scoped registration is also available:

builder.Services.AddAdaptiveCardUtilAsScoped();

Both methods register IAdaptiveCardUtil only when it has not already been registered, so an application can supply its own implementation before calling the registrar.

Build a diagnostic card

Inject IAdaptiveCardUtil, assemble the content, and pass the resulting AdaptiveCard to the client responsible for delivering or serializing it:

using System.Diagnostics;
using Soenneker.AdaptiveCard.Util.Abstract;

public sealed class FailureCardFactory
{
    private readonly IAdaptiveCardUtil _cardUtil;

    public FailureCardFactory(IAdaptiveCardUtil cardUtil)
    {
        _cardUtil = cardUtil;
    }

    public AdaptiveCards.AdaptiveCard Create(
        string orderId,
        Exception exception)
    {
        var facts = new Dictionary<string, string?>
        {
            ["Order"] = orderId,
            ["Region"] = "us-east",
            ["Correlation ID"] = Activity.Current?.Id
        };

        return _cardUtil.Build(
            title: "Order processing failed",
            summary: "The order worker stopped before completion.",
            facts: facts,
            e: exception,
            additionalBody: "Review the worker logs before retrying the order.");
    }
}

The resulting card uses Adaptive Card schema 1.2 and includes the Microsoft Teams msteams.width = Full property. Fact entries with a null or empty value are omitted. Exception and additional-body text wrap automatically.

To stay within practical Teams payload limits, text blocks larger than 27 KiB in UTF-8 are truncated to at most 5,000 characters and the truncation is logged.

Environment and ProjectName are read from IConfiguration. For example, in appsettings.json:

{
  "Environment": "Production",
  "ProjectName": "Order Processor"
}

Only non-empty configured values are included. Machine name and the current Eastern Time timestamp are added automatically.

Build a table card

BuildTable<T> uses each public property name as a column heading and each property value as a cell:

using Soenneker.AdaptiveCard.Util.Abstract;

public sealed record DeploymentRow(
    string Service,
    string Version,
    string Status);

static AdaptiveCards.AdaptiveCard CreateDeploymentCard(
    IAdaptiveCardUtil cardUtil)
{
    var rows = new List<DeploymentRow>
    {
        new("API", "4.12.0", "Healthy"),
        new("Worker", "4.12.0", "Degraded")
    };

    return cardUtil.BuildTable(
        title: "Deployment status",
        items: rows,
        summary: "Production services");
}

Property getters are cached per item type, so repeated calls with the same T do not repeat the reflection setup. Cell values are produced with ToString(); null values become empty cells.

Keep table models intentionally small. Adaptive Cards do not provide responsive HTML-style tables, and every public property becomes a column. Project data into a dedicated row type when you need to control column names, order, or formatting.

BuildTable adds its title and column headings only when items contains at least one row. Handle an empty result separately when the card must explicitly say that no records were found.

API

Method Purpose
Build(string title, string? summary, Dictionary<string, string?>? facts, Exception? e, string? additionalBody) Creates a general diagnostic or informational card.
BuildTable<T>(string title, List<T> items, string? summary) Creates a property-based table card from a typed list.
AddAdaptiveCardUtilAsSingleton() Registers IAdaptiveCardUtil as a singleton.
AddAdaptiveCardUtilAsScoped() Registers IAdaptiveCardUtil as scoped.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.762 91 11/19/2026
11.0.761 85 11/19/2026
11.0.760 89 11/18/2026
11.0.759 85 11/18/2026
11.0.755 96 11/15/2026
11.0.754 97 11/15/2026
11.0.753 93 11/14/2026
11.0.752 115 11/11/2026
11.0.751 109 11/11/2026
11.0.750 84 11/11/2026
11.0.749 87 11/11/2026
11.0.748 94 11/11/2026
11.0.747 94 11/11/2026
11.0.746 103 11/11/2026
11.0.744 99 11/11/2026
11.0.743 99 11/11/2026
11.0.742 105 11/10/2026
11.0.741 153 11/3/2026
11.0.740 71 11/3/2026
11.0.738 67 11/3/2026
Loading failed

Updated Multiple NuGet packages