Search code examples
botframeworkmicrosoft-teamsnuget-packagefromfile

Upgrading Microsoft.Bot.Builder.LanguageGeneration to 4.15.0 results in fromFile() error


Upgrading Microsoft.Bot.Builder.LanguageGeneration from 4.14.1 to 4.15.0 results in new errors about the fromFile() method. Couldn't find any solution or similar issues on the internet yet. This holds us from upgrading so any feedback is welcome.

/UnitTests/bin/Debug/net5.0/Resources/Lg/General.lg line 25:2 - line 25:39: Error occurred when parsing expression 'fromFile('../Cards/HelpCard.json')'. fromFile does not have an evaluator, it's not a built-in function or a custom function.

Solution

  • This release introduces a global flag called "Templates.EnableFromFile" that indicates whether the Adaptive Expression fromFile function is allowed in LG templates. If an application had previously made use of this function, it is now required to add the line "Templates.EnableFromFile = true;" to the Startup.cs code.

    from botbuilder-dotnet/releases

    Adding it in Startup.cs (or Program.cs) didn't help. I had to put it in the constructor of the service where I used the Templates class.