Create a bot with the Bot Framework SDK for .NET
This topic is for the latest release of the SDK (v4). You can find content for the older version of the SDK (v3) here.
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 2017
- 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 Bot Framework Echo Bot V4 template.
If needed, change the project build type to
.Net Core 2.1. Also if needed, update the
Microsoft.Bot.Builder NuGet packages.
Thanks to the template, your project contains all of the code that's necessary to create the bot in this quickstart. You won't actually need to write any additional code.
Start your bot in Visual Studio
When you click the run button, Visual Studio will build the application, deploy it to localhost, and launch the web browser to display the application's
default.htm page. At this point, your bot is running locally.
Start the emulator and connect your bot
Next, start the emulator and then connect to your bot in the emulator:
- Click the Open Bot link in the emulator "Welcome" tab.
- Select the .bot file located in the directory where you created the Visual Studio solution.
Interact with your bot
Send a message to your bot, and the bot will respond back with a message.
If you see that the message can not be sent, you might need to restart your machine as ngrok didn't get the needed privileges on your system yet (only needs to be done one time).
See tunneling (ngrok) for how to connect to a bot hosted remotely.
Would you like to provide feedback?
Our feedback system is built on GitHub Issues. Read more on our blog.