Search code examples
botframeworkadaptive-cardsadaptive-dialogs

Why do I get the error fromFile not a built-in function in botframework


I have upgraded to the latest version of botframework and started to get the error:

Oops, it looks like something went wrong. Error:[Error] D:\home\site\wwwroot\Dialogs\RootDialog\LG\en\RootDialog_en.lg line 15:2 - line 15:69: Error occurred when parsing expression ‘json(fromFile(’…/…/Cards/en/OnChooseIntentAdaptiveCard.json’))'. fromFile does not have an evaluator, it’s not a built-in function or a custom function.

LG code:


# AdaptiveCard
[Activity
    Attachments = ${json(AdaptiveCard.Definition())}
]



# AdaptiveCard.Definition
- ${json(fromFile('../../Cards/en/OnChooseIntentAdaptiveCard.json'))}



# chooseIntentResponseWithCard_en()
[Activity
    Attachments = ${ActivityAttachment(json(fromFile('../../Cards/en/OnChooseIntentAdaptiveCard.json')), 'adaptiveCard')}
]



# Greeting_en()
[Activity
    Attachments = ${ActivityAttachment(json(fromFile('../../Cards/en/GreetingCard.json')), 'adaptiveCard')}
    AttachmentLayout = list
]

What am I missing?


Solution

  • fromFile is now disabled by default. You can change set the value on the Microsoft.Bot.Builder.LanguageGeneration.Templates class:

    Templates.EnableFromFile = true;