microsoft/agents/teams-sdk-to-agents-sdk-dotnet-migration

Claude Code and agent skill by microsoft/agents

Trust tier 4
  • vendor
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when migrating a customer's Teams SDK (teams.net) bot to the Microsoft 365 Agents SDK in .NET. Triggered by projects that depend on Microsoft.Teams.Plugins.AspNetCore, Microsoft.Teams.Apps, or Microsoft.Teams.Api and call builder.AddTeams() / app.UseTeams().

Install

npx vskill@latest install microsoft/agents/teams-sdk-to-agents-sdk-dotnet-migration

SKILL.md

The same SKILL.md was published earlier as microsoft/agents/teams-sdk-to-agents-sdk-dotnet-migration.

Teams SDK (teams.net) to Agents SDK Migration (.NET)

Overview

When an automation caller supplies validation tools instead of shell access, use those tools to perform the build, tests, and startup checks required below. A current passing tool result is equivalent evidence; do not request unavailable shell access or claim validation from source inspection alone. Follow the caller's read-only role when reviewing.

Migrates a Teams SDK (teams.net, https://github.com/microsoft/teams.net) bot to a Microsoft 365 Agents SDK `AgentApplication`. The Teams SDK registers fluent event delegates (teamsApp.OnMessage(async context => ...)) on an IContext<T>; the Agents SDK routes activities to handler methods on an AgentApplication subclass using ITurnContext.

This is NOT the Bot Framework migration. If the project depends on Microsoft.Bot.Builder*, use bf-to-agents-sdk-dotnet-migration instead. Trigger this skill only for teams.net projects (Microsoft.Teams.Plugins.AspNetCore, Microsoft.Teams.Apps, Microsoft.Teams.Api).

Agents SDK repository: https://github.com/microsoft/agents-for-net Teams SDK repository: https://github.com/microsoft/teams.net


Core Rules

  • Preserve behavior. Keep the same commands, text matching, and responses except for user-facing references to the migrated runtime, which should say "agent" instead of "bot". Make other response changes only when required to run on the Agents SDK.
  • Describe the migrated runtime as an agent in README text, catalog descriptions, and user-facing messages. Keep platform terms such as Azure Bot, bot ID, and manifest bots[], and preserve source-derived paths and identifiers unless the caller requests a rename.
  • After source migration is stable, use the standalone teams-app-manifest skill to generate, complete,

or audit the Teams app manifest from source evidence and explicit product intent. Do not embed manifest feature rules in this migration skill.

  • Use stable Agents SDK packages. A caller's minimum Agents SDK version is a floor, not the

version to copy into the project. In automated sample sync, use the selectedAgentsSdkVersion in the frozen sync context. Respect a customer's explicitly selected release line. Otherwise, read the Agents SDK release history JSON (follow later pages when needed) and select the newest stable release within the permitted major, then confirm a common major.minor release line for Microsoft.Agents.Hosting.AspNetCore, Microsoft.Agents.Authentication.Msal, and Microsoft.Agents.Extensions.MSTeams from the Hosting, Authentication, and MSTeams JSON version feeds. Use the newest compatible stable line available for all three, without assuming their patch numbers match. Do not select a prerelease or a new major version without explicit policy.

  • If the project defines the AgentApplication during DI (typically in Program.cs), ask the customer

whether to keep it inline or move it to an AgentApplication subclass with Teams route attributes. In the automated Teams sample sync, do not ask a user. Apply an applicable migration policy or return needs-policy with evidence and a recommended policy.

  • If creating a subclass, always use [TeamsExtension], mark it partial, use Teams route attributes,

and take ITeamsTurnContext in route handlers.

  • After restoring packages, verify route attributes, handler delegate signatures, payload models, and

response types against the installed configured-version XML documentation or current Agents SDK source. Do not infer an API shape from a similarly named Teams SDK API.

  • Preserve the original registration and if/else precedence. Use explicit route rank values

whenever multiple text or invoke routes can match the same activity.

  • Prefer SendActivityAsync("text", cancellationToken: ct) for plain text. When a reply needs entities, attachments, or other activity fields, build an activity with Activity.CreateMessageActivity() and fluent methods such as .WithText(...), then set the extra fields. Keep a factory when it adds value for a structured response.
  • Use the agent's logger for diagnostics instead of Console.WriteLine; pass exceptions to structured logging rather than logging only their messages.

Package Replacements

Out-of-repo samples use PackageReferences (not ProjectReferences). Replace the single Teams SDK package with the Agents SDK packages, using the selected major.minor release line for all three. Replace RESOLVED_VERSION below with that line's floating version (for example, major.minor.*) before writing the project file:

Remove (Teams SDK)Add (Agents SDK)
Microsoft.Teams.Plugins.AspNetCoreMicrosoft.Agents.Hosting.AspNetCore + Microsoft.Agents.Authentication.Msal
(Teams routing surface)Microsoft.Agents.Extensions.MSTeams
Microsoft.Teams.Cards (if used)Microsoft.Teams.Cards (kept — Agents MSTeams extension reuses it)
xml
<ItemGroup>
<PackageReference Include="Microsoft.Agents.Hosting.AspNetCore" Version="RESOLVED_VERSION" />
<PackageReference Include="Microsoft.Agents.Authentication.Msal" Version="RESOLVED_VERSION" />
<PackageReference Include="Microsoft.Agents.Extensions.MSTeams" Version="RESOLVED_VERSION" />
</ItemGroup>

Microsoft.Agents.Hosting.AspNetCore transitively brings Microsoft.Agents.Builder, Microsoft.Agents.Core, Microsoft.Agents.Connector, and Microsoft.Agents.Storage. The [TeamsExtension] source generator ships inside Microsoft.Agents.Core (analyzers folder), so NuGet consumers get it transitively — no explicit analyzer PackageReference is needed.

TargetFramework: use the repository's configured target framework, currently net10.0. Set <TargetFramework>net10.0</TargetFramework>. Set <ImplicitUsings>disable</ImplicitUsings> and add explicit using directives (matches Agents SDK sample convention).


SDK 1.9 payload compatibility

For the 1.9 release line, read SDK 1.9 Teams payloads before changing handlers. A package upgrade alone is insufficient: file consent, dialogs, message extensions, and meeting payloads changed. Verify against the installed version; do not copy 1.8 Microsoft.Teams.Api.* models or guess types in the Agents routing namespace.

Namespace Replacements

Teams SDK (teams.net)Agents SDK
Microsoft.Teams.Plugins.AspNetCore.ExtensionsMicrosoft.Agents.Hosting.AspNetCore
Microsoft.Teams.AppsMicrosoft.Agents.Builder, Microsoft.Agents.Builder.App
Microsoft.Teams.Apps.ActivitiesMicrosoft.Agents.Builder.App (routing)
Microsoft.Teams.Api.ActivitiesMicrosoft.Agents.Core.Models
Microsoft.Teams.Api (activity/card models)Microsoft.Agents.Core.Models
Microsoft.Teams.Api (Teams route payloads, SDK 1.9)Microsoft.Teams.Apps.Files, .TaskModules, .MessageExtensions, .Meetings, .Clients — see the version-specific guide
(Teams-specific) Microsoft.Teams.Apps.Activities.Events etc.Microsoft.Agents.Extensions.MSTeams.*

Migration Steps

Step 1 — Scaffold the copy

Create agentsdk-<name>/dotnet/agentsdk-<name>/ mirroring the customer's source layout. Files:

  • <Project>.csproj — SDK.Web, net10.0, PackageReferences above.
  • Program.cs — Agents SDK host (Step 3).
  • <Name>Agent.cs — the AgentApplication subclass (Step 4).
  • AspNetExtensions.cs — required. AddAgentAspNetAuthentication() is not in any NuGet package;

copy it verbatim from an Agents SDK sample (src/samples/Shared/AspNetExtensions.cs in agents-for-net; automation supplies its pinned local copy under automation/teams-sample-sync/reference/dotnet).

  • appsettings.json — non-secret Agents SDK config (Step 5); keep local credentials in an ignored appsettings.Development.json or environment variables.
  • Properties/launchSettings.json — applicationUrl: http://localhost:3978.
  • README.md — explain the migrated Agents SDK application and its customer-specific setup.
Step 2 — Map the surface area to route attributes

Scan the Teams SDK Program.cs (or handler files) for the teamsApp.On* registrations and map each to its Teams route attribute (see the tables below). The agent is always a [TeamsExtension] partial class — OnMessage → [TeamsMessageRoute], OnConversationUpdate → [TeamsMembersAddedRoute] / [TeamsMembersRemovedRoute], plus any Teams-specific On*.

Step 3 — Program.cs

The Teams SDK bootstrap becomes the Agents SDK host:

csharp
// Teams SDK
var builder = WebApplication.CreateBuilder(args);
builder.AddTeams();
var webApp = builder.Build();
var teamsApp = webApp.UseTeams(true);
// ... teamsApp.On*(...) registrations ...
webApp.Run();
csharp
// Agents SDK
using MyAgentNamespace;
using Microsoft.Agents.Hosting.AspNetCore;
using Microsoft.AspNetCore.Builder;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.AddAgentDefaults()
.AddAgent<MyAgent>()
.AddAgentAuthorization(b => b.AddAgentAspNetAuthentication());
WebApplication app = builder.Build();
app.UseAgents();
app.MapDefaultAgentEndpoints(); // GET "/" + POST /api/messages
app.Run();

AddAgentDefaults() registers MemoryStorage, default options, and the standard HTTP client services. Do not add builder.Services.AddHttpClient() to Program.cs. Inline teamsApp.On* lambdas move to handler methods on the agent class (Step 4).

Step 4 — The agent class

Convert inline delegates into a [TeamsExtension] partial AgentApplication subclass. Route each command with a Teams route attribute; handlers take `ITeamsTurnContext`.

This context rule applies to route attributes from Microsoft.Agents.Extensions.MSTeams.App. Base Agents SDK routes must use their documented delegate signature. For example, [ActionExecuteRoute] uses ITurnContext, not ITeamsTurnContext.

Text dispatch semantics ([TeamsMessageRoute]):

  • [TeamsMessageRoute("whoami")] — exact text match, case-insensitive.
  • [TeamsMessageRoute(textRegex: "(?i)whoami")] — regex match; use this to reproduce the Teams SDK's

text.Contains(...) dispatch (add (?i) for case-insensitivity).

  • [TeamsMessageRoute] (no argument) — catch-all; matches any message and defaults to RouteRank.Last

so specific-text routes win.

  • When several Contains branches could overlap, set rank: (lower = higher priority) to preserve the

original if/else precedence.

csharp
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Agents.Builder.App;
using Microsoft.Agents.Builder.State;
using Microsoft.Agents.Core.Models; // Activity, Mention, ActivityTypes
using Microsoft.Agents.Extensions.MSTeams; // [TeamsExtension], ITeamsTurnContext
using Microsoft.Agents.Extensions.MSTeams.App; // [TeamsMessageRoute], [TeamsMembersAddedRoute]
namespace MyAgentNamespace;

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 2 Oct 2026.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1,077
Repository forks
343
7-day trend score
40

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill CERTIFIED badge
[![vskill CERTIFIED](https://verified-skill.com/api/v1/skills/microsoft/agents/teams-sdk-to-agents-sdk-dotnet-migration/badge)](https://verified-skill.com/skills/microsoft/agents/teams-sdk-to-agents-sdk-dotnet-migration)

Something wrong with this skill or its page? Tell us.