Reputation: 11
how can i implement bot framework in my visual studio code ,And what packages are need to be installed for the usage of bot framework in visual studio code?
Upvotes: 1
Views: 2939
Reputation: 318
If you are using VS Code and want to use .Net Core you can import the following templates. These are found within the README.md of the Generator/template directory on github.
https://github.com/microsoft/BotBuilder-Samples/tree/master/generators/dotnet-templates
# Installs all three templates (echo, core, empty)
dotnet new -i Microsoft.Bot.Framework.CSharp.EchoBot
dotnet new -i Microsoft.Bot.Framework.CSharp.CoreBot
dotnet new -i Microsoft.Bot.Framework.CSharp.EmptyBot
then create from the project from the template as you would any other template.
# example using the echobot template
dotnet new echobot
Upvotes: 1
Reputation: 7241
This is a pretty broad question, but I'll try to cover all of the bases bases and include answers for Node/JS/TS as well as C#.
You have 4 options:
Create the bot in Azure:
[JS/TS/Node ONLY] Create the bot via Yeoman: (See JavaScript Quickstart below)
npm install -g yo generator-botbuilder
yo botbuilder
. [C# ONLY]: Use a VSIX template in Visual Studio:**
Clone a Sample:
REAMDE.md
for further instruction.Create it from scratch as @TobiasC mentioned. I highly recommend against going this route unless you know what you're doing. It is much easier to start with a sample. Using Yeoman to generate an Empty Bot is a good route to go if you want something pretty bare bones.
The required packages really varies depending on what you're going to do with your bot.
JS/TS/Node: Here's a snippet of Basic Bot's package.json
, showing all the packages it uses:
"dependencies": {
"botbuilder": "^4.2.0",
"botbuilder-ai": "^4.2.0",
"botbuilder-dialogs": "^4.2.0",
"botframework-config": "^4.2.0",
"dotenv": "^6.1.0",
"restify": "^7.2.3"
},
"devDependencies": {
"eslint": "^5.9.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"nodemon": "^1.18.6"
}
C# Here's a list of NuGet packages for Basic Bot from the .csproj
file:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.ContentModerator" Version="0.12.1-preview" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Language" Version="1.0.1-preview" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Configuration" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.2.2" />
<PackageReference Include="Microsoft.Bot.Schema" Version="4.2.2" />
<PackageReference Include="Microsoft.Graph" Version="1.10.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008">
Run npm start
from within the bot's directory (Node/JS/TS) or press F5 in Visual Studio (C#). By default, the bot will listen for messages at http://localhost:3978
Use the BotFramework Emulator for local testing. See "Botframework Emulator - Getting Started" below.
Really, I recommend following the docs and samples as much as possible and using the SDK Reference, when necessary. Links below.
Botframework Emulator - Getting Started
Upvotes: 2
Reputation: 61
there are two ways: Create a Bot within Azure using one of the templates and download the files afterwards or create it from the scratch. The selection of the necessary packages depends on your UseCase. However, basic packages should be:
To run and test the bot locally you will also need the Bot Framework Emulator.
Hope that helps
Upvotes: 1