microsoft/agents/bf-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 Bot Framework .NET SDK bot to Microsoft 365 Agents SDK. Triggered by projects that depend on packages: Microsoft.Bot.Builder or Microsoft.Bot.Builder.Integration.AspNet.Core that want to migrate to Agents SDK.

Install

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

SKILL.md

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

Bot Framework to Agents SDK Migration (.NET)

Overview

Migrates a Bot Framework SDK bot to Microsoft 365 Agents SDK using the ActivityHandler/TeamsActivityHandler compat layer — minimal code changes, original class names preserved.

This skill stops at the compat layer. After completing this migration, ask the user whether to also convert to AgentApplication (see final step).

Agents DotNet SDK repository: https://github.com/microsoft/agents-for-net Bot Framework DotNet SDK repository: https://github.com/microsoft/botbuilder-dotnet


Core Rules

  • Retain the original bot class name. Do not rename or create a new class — renaming breaks git history.
  • Only change what is required for a clean migration. Do not refactor, restructure, or improve beyond what is needed to compile and run on Agents SDK.

Package Replacements

Version: Always use the latest stable (non-beta) version of Agents SDK packages by default.

Remove (Bot Framework)Add (Agents SDK)
Microsoft.Bot.Builder.Integration.AspNet.CoreMicrosoft.Agents.Hosting.AspNetCore
Microsoft.Bot.BuilderMicrosoft.Agents.Builder
Microsoft.Bot.Builder.TeamsMicrosoft.Agents.Extensions.Teams
Microsoft.Bot.Builder.DialogsMicrosoft.Agents.Builder.Dialogs
Microsoft.Bot.ConnectorMicrosoft.Agents.Connector
Microsoft.Bot.Connector.Authentication / MSAL auth packagesMicrosoft.Agents.Authentication.Msal

Deprecated Packages — No Agents SDK Equivalent

The following Bot Framework packages have no equivalent in the Agents SDK and are not supported. There is no recommended replacement. Remove them from the .csproj, but do not attempt to migrate the code that uses them — it will cause build errors that cannot be resolved within the Agents SDK migration. Flag this to the customer.

Deprecated Package
Microsoft.Bot.Builder.AI.Luis
Microsoft.Bot.Builder.AI.Orchestrator
Microsoft.Bot.Builder.AI.QnA
Microsoft.Bot.Builder.Azure.Queues
Microsoft.Bot.Builder.Dialogs.Adaptive
Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime
Microsoft.Bot.Builder.Dialogs.Adaptive.Testing
Microsoft.Bot.Builder.Dialogs.Debugging
Microsoft.Bot.Builder.LanguageGeneration
Microsoft.Bot.Builder.TemplateManager
Microsoft.Bot.Configuration
Microsoft.Bot.Connector.Streaming
Microsoft.Bot.Streaming
Microsoft.Bot.Builder.Parsers.LU
AdaptiveExpressions

Migration still proceeds — complete all other migration steps. The build errors from unmigrated code must be communicated to the customer as out-of-scope blockers.


Namespace Replacements

OldNew
Microsoft.Bot.BuilderMicrosoft.Agents.Builder
Microsoft.Bot.Builder (ActivityHandler)Microsoft.Agents.Builder.Compat
Microsoft.Bot.Builder (AutoSaveStateMiddleware)Microsoft.Agents.Builder.Compat
Microsoft.Bot.Builder.Teams (TeamsActivityHandler)Microsoft.Agents.Extensions.Teams.Compat
Microsoft.Bot.SchemaMicrosoft.Agents.Core.Models
Microsoft.Bot.Schema.TeamsMicrosoft.Agents.Extensions.Teams.Models
Microsoft.Bot.Builder.DialogsMicrosoft.Agents.Builder.Dialogs
Microsoft.Bot.Builder.Dialogs (PromptValidatorContext, PromptValidatorContext\<T\>)Microsoft.Agents.Builder.Dialogs.Prompts
Microsoft.Bot.Builder.Integration.AspNet.CoreMicrosoft.Agents.Hosting.AspNetCore
Microsoft.Bot.Builder.TraceExtensions(remove) — TraceActivityAsync is built into ITurnContext

Migration Steps

Step 1: Update packages and namespaces (see tables above)
Step 2: Keep bot class — retain original class name, only update using statements

ActivityHandler and TeamsActivityHandler exist unchanged in the Compat namespace. All override methods keep the same signatures. Do not rename the class.

csharp
// Before
using Microsoft.Bot.Builder;
using Microsoft.Bot.Schema;
public class EchoBot : ActivityHandler { /* unchanged */ }
// After — only using directives change; class name stays EchoBot
using Microsoft.Agents.Builder;
using Microsoft.Agents.Builder.Compat; // ActivityHandler lives here
using Microsoft.Agents.Core.Models; // IMessageActivity, ChannelAccount, etc.
public class EchoBot : ActivityHandler { /* unchanged */ }

For Teams:

csharp
// Before
using Microsoft.Bot.Builder.Teams;
using Microsoft.Bot.Schema.Teams;
public class MyBot : TeamsActivityHandler { /* unchanged */ }
// After — class name stays MyBot
using Microsoft.Agents.Extensions.Teams.Compat; // TeamsActivityHandler lives here
using Microsoft.Agents.Extensions.Teams.Models; // TeamsChannelAccount, TeamInfo, etc.
public class MyBot : TeamsActivityHandler { /* unchanged */ }
Step 3: State management for dialog bots

If the bot overrides OnTurnAsync to call SaveChangesAsync, both patterns work — keep whichever the bot already uses:

csharp
// Option A: Keep existing pattern in OnTurnAsync (works as-is)
public override async Task OnTurnAsync(ITurnContext ctx, CancellationToken ct)
{
await base.OnTurnAsync(ctx, ct);
await ConversationState.SaveChangesAsync(ctx, false, ct);
await UserState.SaveChangesAsync(ctx, false, ct);
}
// Option B: Use AutoSaveStateMiddleware (register in adapter setup)
// adapter.Use(new AutoSaveStateMiddleware(conversationState, userState));
Step 4: New Program.cs

Delete BotController.cs and AdapterWithErrorHandler.cs. Create Program.cs:

csharp
using Microsoft.Agents.Hosting.AspNetCore;
using Microsoft.Agents.Storage;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpClient();
builder.Services.AddControllers();
// Register bot — AddAgent works because ActivityHandler implements IAgent
// DO NOT call AddAgentApplicationOptions() — that is only for AgentApplication
builder.AddAgent<MyBot>();
// Storage — always required by the Agents SDK
builder.Services.AddSingleton<IStorage, MemoryStorage>();
// Preserve all customer-specific DI registrations:
// builder.Services.AddSingleton<ConversationState>();
// builder.Services.AddSingleton<UserState>();
// builder.Services.AddSingleton<MyDialog>();
// builder.Services.AddSingleton<IMyService, MyService>();
// AddAgentAspNetAuthentication is defined in AspNetExtensions.cs — copy from any Agents SDK sample
builder.Services.AddAgentAspNetAuthentication(builder.Configuration);
WebApplication app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapAgentRootEndpoint();
// ActivityHandler bots use MapAgentEndpoints — NOT MapAgentApplicationEndpoints
// MapAgentApplicationEndpoints only works for AgentApplication subclasses
app.MapAgentEndpoints(requireAuth: !app.Environment.IsDevelopment());
if (app.Environment.IsDevelopment())
{
app.Urls.Add("http://localhost:3978");
}
app.Run();

If customer had custom logic in `BotController`, preserve it using the process delegate:

csharp
app.MapAgentEndpoints(
requireAuth: !app.Environment.IsDevelopment(),
process: async (request, response, adapter, agent, ct) =>
{
// Custom controller logic here
await adapter.ProcessAsync(request, response, agent, ct);
});
Step 5 or at the very end of the migration: Ask user if they would like to write the learnings from this migration to a markdown file they could submit to use to help us improve the skill.

appsettings.json Changes

Remove Bot Framework auth config and add Agents SDK config. The shape of Connections:ServiceConnection depends on the value of MicrosoftAppType in the existing appsettings.

In all cases: remove MicrosoftAppId, MicrosoftAppPassword, MicrosoftAppType, and MicrosoftAppTenantId — their values are carried forward into the new structure.


Case 1: MicrosoftAppType = "SingleTenant"
json
{
"Connections": {
"ServiceConnection": {
"Settings": {
"AuthType": "ClientSecret",
"AuthorityEndpoint": "https://login.microsoftonline.com/{MicrosoftAppTenantId}",
"ClientId": "{MicrosoftAppId}",
"ClientSecret": "{MicrosoftAppPassword}",
"Scopes": ["https://api.botframework.com/.default"]
}
}
},
"ConnectionsMap": [
{
"ServiceUrl": "*",
"Connection": "ServiceConnection"
}
],
"TokenValidation": {
"Enabled": true,
"Audiences": ["{MicrosoftAppId}"],
"TenantId": "{MicrosoftAppTenantId}"
}
}

Case 2: MicrosoftAppType = "UserAssignedMSI"
json
{
"Connections": {
"ServiceConnection": {
"Settings": {
"AuthType": "UserManagedIdentity",
"ClientId": "{MicrosoftAppId}",
"Scopes": ["https://api.botframework.com/.default"]
}
}
},
"ConnectionsMap": [
{
"ServiceUrl": "*",
"Connection": "ServiceConnection"
}
],
"TokenValidation": {
"Enabled": true,
"Audiences": ["{MicrosoftAppId}"],
"TenantId": "{MicrosoftAppTenantId}"
}
}

Case 3: MicrosoftAppType = "MultiTenant", missing, or null
json
{
"Connections": {
"ServiceConnection": {
"Settings": {
"AuthType": "ClientSecret",
"AuthorityEndpoint": "https://login.microsoftonline.com/botframework.com",
"ClientId": "{MicrosoftAppId}",
"TenantId": "{MicrosoftAppTenantId}",
"ClientSecret": "{MicrosoftAppPassword}",
"Scopes": ["https://api.botframework.com/.default"]
}
}
},
"ConnectionsMap": [
{
"ServiceUrl": "*",
"Connection": "ServiceConnection"
}
],
"TokenValidation": {
"Enabled": true,
"Audiences": ["{MicrosoftAppId}"],
"TenantId": "{MicrosoftAppTenantId}"
}
}

Case 4: Any other MicrosoftAppType value

Do not generate Connections:ServiceConnection. Complete all other migration steps, then at the end inform the user:

"The MicrosoftAppType value {value} is not a standard type recognized by this migration. The Connections:ServiceConnection block was not changed — additional manual configuration will be required. See: https://learn.microsoft.com/en-us/microsoft-365/agents-sdk/microsoft-authentication-library-configuration-options"

Custom BotAdapter

If the source bot subclasses BotAdapter, migrate it to ChannelAdapter (Microsoft.Agents.Builder).

Class hierarchy to choose from
Use whenSubclass
Custom transport / non-Azure channelChannelAdapter (abstract, minimal pipeline)
Azure Bot Service connectivity with custom behaviorCloudAdapter (Microsoft.Agents.Hosting.AspNetCore)

Most custom BotAdapter subclasses fall into the CloudAdapter case. Prefer that unless the adapter is implementing a completely custom transport.

API mapping
Bot Framework BotAdapterAgents SDK
using Microsoft.Bot.Builder;using Microsoft.Agents.Builder;
: BotAdapter: ChannelAdapter or : CloudAdapter
Activity[] in SendActivitiesAsyncIActivity[] in SendActivitiesAsync
BotCallbackHandler callback delegateAgentCallbackHandler
abstract UpdateActivityAsync(...)virtual UpdateActivityAsync(...) (throws NotImplementedException if not overridden)
abstract DeleteActivityAsync(...)virtual DeleteActivityAsync(...) (throws NotImplementedException if not overridden)
protected RunPipelineAsync(ctx, BotCallbackHandler, ct)protected RunPipelineAsync(ctx, AgentCallbackHandler, ct)
Registration

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 7 Aug 2026.
  • Model reviewPassed

Quality evaluation

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

Source

Popularity

Repository stars
1,024
Repository forks
331
7-day trend score
35

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 26 Jul 2026, 4 months ago.

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/bf-to-agents-sdk-dotnet-migration/badge)](https://verified-skill.com/skills/microsoft/agents/bf-to-agents-sdk-dotnet-migration)

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