Tutorial: Convert a v4 Bot (csharp)

Add Bot Framework Solutions packages

  1. Implement MVC architecture
    • If you have an existing bot using the v4 SDK, following the MVC approach from this Bot Builder sample.
  2. Enable the Bot Framework Solutions packages
  3. Create a custom Skill adapter

    • Create a a custom adapter class that derives from the SkillAdapter and add the SkillMiddleware.cs class is added to it.

        public class CustomSkillAdapter : SkillAdapter
              public CustomSkillAdapter(
                  BotSettings settings,
                  ICredentialProvider credentialProvider,
                  BotStateSet botStateSet,
                  ResponseManager responseManager,
                  IBotTelemetryClient telemetryClient,
                  UserState userState)
                  : base(credentialProvider)
                  Use(new SkillMiddleware(userState));
  4. Add the Skill services to startup
    • In your startup.cs file, add the following Transient adapters:

      services.AddTransient<IBotFrameworkHttpAdapter, DefaultAdapter>();
      services.AddTransient<SkillAdapter, CustomSkillAdapter>();
  5. Update your BotController class

    • Update your BotController.cs class to derive from SkillController

        public class BotController : SkillController
            public BotController(IServiceProvider serviceProvider, BotSettingsBase botSettings)
                : base(serviceProvider, botSettings)
            { }