I have the following code that works well when I sync it to my Git project and test it on my Azure Bot instance channel:
[LuisIntent("Greeting")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
string s = string.Empty;
string name = string.Empty;
var entities = new List<EntityRecommendation>(result.Entities);
if (entities.Any((entity) => entity.Type == "ClientName"))
{
var clientName = entities.Where((entity) => entity.Type == "ClientName").First();
name = clientName.Entity;
s += "Your name is " + name;
}
else
{
s += "What is your name?";
}
await context.PostAsync($"You gave a greeting. {s}");
context.Wait(MessageReceived);
}
But when I run it on the emulator, I get "Sorry, my bot code is having an issue." with the following error:
A ScriptHost error has occurred Exception while executing function: Functions.messages. Microsoft.Bot.Builder: Value cannot be null. Parameter name: modelID.
On top of that I get the warning:
Unable to find assembly 'Microsoft.Bot.Builder.resources, Version=3.9.0.0, Culture=en-US, PublicKeyToken=31bf3856ad364e35'. Are you missing a private assembly file?
How do I make it work on my emulator? I would rather be able to test it working locally first before I push it to my instance.
I was able to debug locally by hard coding my LUISApiKey and LUISAppID. I got those values from the portal > MyAzureBot > Settings > Application Settings.
They rolled some new changes in this weekend - the Bot Service projects downloaded from the portal are no longer CSX, they look like regular Web projects, so the nuget package manager is now usable. But it is still having that same error above even with the nuget package properly installed. This time I can uninstall and re-install it and I can actually see /bin folder. Still the same error with the Bot Builder package there.
I would still like a non-hack solution. But this one is working well for now.