microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

`dotnet new` project templates #5857

Closed maartenba closed 4 years ago

maartenba commented 4 years ago

Right now, there are project templates available for Visual Studio (https://marketplace.visualstudio.com/items?itemName=BotBuilder.botbuilderv4).

While nice, these only work for Visual Studio and on Windows. To support macOS and Linux users, having dotnet new templates instead would be much appreciated.

SamVanhoutte commented 4 years ago

I also need this, as I'm using macOS and really want to leverage the bot framework templates for my development. In the world of Data & A.I. where cross platform thrives, this would really make so much sense.

dmvtech commented 4 years ago

Hi @Maarten88 and @SamVanhoutte

I have moved this to the more appropriate repository and labled as an enhancement.

Also; just wanted to share that there is a Yeoman template you can use as well: npm install -g yo generator-botbuilder

https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-basic-deploy?view=azure-bot-service-4.0&tabs=javascript#create-a-bot

cleemullins commented 4 years ago

We have those. :)

The Code upon which they are based is in Github.

The packages are all in Nuget. For example, here is the EchoBot template.

I've snipped a bit of the readme, and put it here.

Installation

  1. Install [.NET Core SDK][4] version 3.1 or higher
    # determine dotnet version
    dotnet --version
  2. Install Bot Framework CSharp templates by typing the following in your console:
    # 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
  3. Verify the templates have been installed correctly by typing the following into your console:

    dotnet new --list

    Sample output from dotnet new --list. Note: Version information for the templates may be different.

    Templates                                         Short Name         Language          Tags
    ----------------------------------------------------------------------------------------------------------------------------
    Bot Framework Core Bot (v0.1.2)                   corebot            [C#]              Bot/Bot Framework/AI/Core Bot
    Bot Framework Echo Bot (v0.1.2)                   echobot            [C#]              Bot/Bot Framework/AI/Echo Bot
    Bot Framework Empty Bot (v0.1.2)                  emptybot           [C#]              Bot/Bot Framework/AI/Empty Bot
    Console Application                               console            [C#], F#, VB      Common/Console
    Class library                                     classlib           [C#], F#, VB      Common/Library
    Unit Test Project                                 mstest             [C#], F#, VB      Test/MSTest
    NUnit 3 Test Project                              nunit              [C#], F#, VB      Test/NUnit
    NUnit 3 Test Item                                 nunit-test         [C#], F#, VB      Test/NUnit
    xUnit Test Project                                xunit              [C#], F#, VB      Test/xUnit
    Razor Page                                        page               [C#]              Web/ASP.NET

Alternate Installation

The above installation steps will install all three Bot Framework templates. If you prefer to install one template or a subset of the three templates, install them individually by following the steps below.

# Install EchoBot template
dotnet new -i Microsoft.Bot.Framework.CSharp.EchoBot
# Install CoreBot template
dotnet new -i Microsoft.Bot.Framework.CSharp.CoreBot
# Install EmptyBot template
dotnet new -i Microsoft.Bot.Framework.CSharp.EmptyBot

Usage

Creating a New Bot Project

Create EchoBot

# Generate an Echo Bot
dotnet new echobot -n MyEchoBot

Create CoreBot

# Generate a Core Bot
dotnet new corebot -n MyCoreBot

Create CoreBot with CoreBot.Test project

# Generate a Core Bot
dotnet new corebot -n MyCoreBotWithTests --include-tests

Create EmptyBot

# Generate an Empty Bot
dotnet new emptybot -n MyEmptyBot

Running Your Bot

Running Your Bot Locally

To run your bot locally, type the following in your console:

# change into the project's folder.  e.g. EchoBot
cd EchoBot
# run the bot
dotnet run

Interacting With Your Bot Using the Emulator

Once the Emulator is connected, you can interact with and receive messages from your bot.

Developing Your Bot Locally

It's often easier to develop the capabilities of your bot locally, and to use the Bot Framework Emulator to test your changes.

Testing CoreBot

If you use the --include-tests command line option when you generated a CoreBot. The CoreBot template will generate two projects CoreBot and CoreBot.Test. To run the CoreBot unit tests:

# build the CoreBot project
cd CoreBot
dotnet build
# build the CoreBot.Tests project
cd ../CoreBot.Tests
dotnet build
# run the unit tests
dotnet test
cleemullins commented 4 years ago

Please let me know if those aren't working correctly for you. They should be up-to-date and work correctly across PC, Mac, and Linux.

maartenba commented 4 years ago

Perfect, thanks!

SamVanhoutte commented 4 years ago

This is great! Thanks guys. Didn't see that before.