C# Microsoft Bot框架程序集引用

C# Microsoft Bot框架程序集引用,c#,botframework,C#,Botframework,我有以下代码,但来自Microsoft机器人创建教程 当我复制并粘贴它时,我的using语句似乎没有在示例中应该使用的时候被使用?我已经尝试添加它建议的using语句,但我认为这不是必需的。我在[BotAuthentication]和活动“找不到类型或命名空间名称“Activity”等方面有错误 我也安装了nugget软件包 using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.We

我有以下代码,但来自Microsoft机器人创建教程

当我复制并粘贴它时,我的using语句似乎没有在示例中应该使用的时候被使用?我已经尝试添加它建议的using语句,但我认为这不是必需的。我在
[BotAuthentication]
活动
“找不到类型或命名空间名称“Activity”等方面有错误

我也安装了nugget软件包

using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System;
using System.Linq;
using System.Configuration;
using Microsoft.Bot.Builder.CognitiveServices.QnAMaker;
using System.Web.Services.Description;
using Microsoft.Bot.Builder.PersonalityChat;
using Microsoft.Bot.Builder.PersonalityChat.Core;

namespace BenTestBot
{
    [BotAuthentication]
public class MessagesController : ApiController
{
    public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
    {
        if (activity.GetActivityType() == ActivityTypes.Message)
        {

            //await Conversation.SendAsync(activity, () => new Qna_Rich_Cards.Dialogs.QnaDialog().DefaultIfException());
            await Conversation.SendAsync(activity, () => new Dialogs.BasicPersonalityChatBotDialog().DefaultIfException());

        }
        else
        {
            await HandleSystemMessageAsync(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }
使用System.Net;
使用System.Net.Http;
使用System.Threading.Tasks;
使用System.Web.Http;
使用Microsoft.Bot.Builder.Dialogs;
使用Microsoft.Bot.Connector;
使用制度;
使用System.Linq;
使用系统配置;
使用Microsoft.Bot.Builder.CognitiveServices.QnAMaker;
使用System.Web.Services.Description;
使用Microsoft.Bot.Builder.PersonalityChat;
使用Microsoft.Bot.Builder.PersonalityChat.Core;
名称空间BenTestBot
{
[身份验证]
公共类消息控制器:ApiController
{
公共异步任务发布([FromBody]活动)
{
if(activity.GetActivityType()==ActivityTypes.Message)
{
//wait Conversation.SendAsync(活动,()=>新的Qna_丰富_卡.对话框.QnaDialog().DefaultIfException());
wait Conversation.SendAsync(活动,()=>newdialogs.BasicPersonalityChatBotDialog().DefaultIfException());
}
其他的
{
等待HandleSystemMessageAsync(活动);
}
var response=Request.CreateResponse(HttpStatusCode.OK);
返回响应;
}

如果您已经安装了nuget软件包,则不应安装该软件包。 也许你应该检查软件包的版本并尝试更新软件包


要使[BotAuthentication]和活动正常工作,您需要Microsoft.Bot.Connector;您的案例中已经有了它,因此请尝试更新。

如果您已经安装了nuget软件包,则不应该有它。 也许你应该检查软件包的版本并尝试更新软件包


用于[身份验证]和活动要正常工作,您需要Microsoft.Bot.Connector;您的案例中已经有了它,请尝试更新。

您是偶然使用visual studio for mac吗?您是偶然使用visual studio for mac吗?我使用的是预览版而不是稳定版,谢谢!我使用的是预览版而不是稳定版,谢谢!