0

I have just started to learn the Microsoft chat bot framework. I have added a Bot application in my VS 2013 professional. I am trying to create the basic chat bot application to calculate the length of the string passed to the bot. But i am getting the error on the CreateReply method as below:

 if (activity.Type == ActivityTypes.Message)
        {
            ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
            int  length = (activity.Text ?? String.Empty).Length;
            Activity reply = activity.CreateReply($"your text {acivity.Text} have {lenght} characters");
            await connector.Conversations.ReplyToActivityAsync(reply);
        }

The above code does not recognize the "$" in CreateReply method.

code snippet

error list

I am using MS VS Professional 2013

Microsoft.Bot.Builder - 3.9.0.0

Please help me to fix this?

Thanks

Tarun
  • 393
  • 1
  • 6
  • 22
  • Are you using C# 6.0? $ as a string formatter didn't exist before that. – JLe Aug 16 '17 at 05:41
  • While creating Bot Application in VS, I have selected .NET Framework 4.6 from the dropdownlist and started working on it. VS studio version I am using is MS VS Professional 2013. – Tarun Aug 16 '17 at 05:57
  • 1
    See this post: https://stackoverflow.com/questions/27093908/how-to-enable-c-sharp-6-0-feature-in-visual-studio-2013 – OmG Aug 16 '17 at 10:58
  • can you used c# 6.0 in VS13? – D4RKCIDE Aug 16 '17 at 23:00
  • I dont know, if we can use c# 6.0 in VS2013. I have updated the VS to 2015. Now, I am not getting any error as I mentioned above. – Tarun Aug 17 '17 at 04:52

0 Answers0