Create a bot with the Bot Framework SDK for .NET
This quickstart walks you through building a bot by using the C# template, and then testing it with the Bot Framework Emulator.
Creating a bot with Azure Bot Service and creating a bot locally are independent, parallel ways to create a bot.
- Visual Studio 2019 or later
- Bot Framework SDK v4 template for C#
- Bot Framework Emulator
- Knowledge of ASP.Net Core and asynchronous programming in C#
Create a bot
Install BotBuilderVSIX.vsix template that you downloaded in the prerequisites section.
In Visual Studio, create a new bot project using the Echo Bot (Bot Framework v4 - .NET Core 3.1) template. Choose AI Bots from the project types to show only bot templates.
Thanks to the template, your project contains all the code that's necessary to create the bot in this quickstart. You don't need any additional code to test your bot.
If you create a
Core bot, you'll need a LUIS language model. (You can create a language model at luis.ai). After creating the model, update the configuration file.
Both .NET Core 2.1 and .NET Core 3.1 versions of the C# templates are available. When creating new bots in Visual Studio 2019, you should use the .NET Core 3.1 templates. The current bot samples use .NET Core 3.1 templates. You can find the samples that use .NET Core 2.1 templates in the 4.7-archive branch of the BotBuilder-Samples repository. For information about deploying .NET Core 3.1 bots to Azure, see Deploy your bot.
Start your bot in Visual Studio
Start your project in Visual Studio. This will build the application, deploy it to localhost, and launch the web browser to display the application's
At this point, your bot is running locally on port 3978.
Start the Emulator and connect to your bot
Next, start the emulator and then connect to your bot in the emulator:
Start the Bot Framework Emulator.
Click Open Bot on the Emulator's Welcome tab.
Enter your bot's URL, which is the URL of the local port, with /api/messages added to the path, typically
Then click Connect.
Send a message to your bot, and the bot will respond back with a message.
See tunneling (ngrok) for how to connect to a bot hosted remotely.