'AdaptiveCard' does not contain a definition for 'FromJson'--Microsoft Bot Framework

99封情书 提交于 2019-12-02 07:27:22

问题


I have tried creating an adaptive card, parsing it from json. As mentioned in https://docs.microsoft.com/en-us/adaptive-cards/create/libraries/net#example-parse-from-json, I have installed AdaptiveCards package and tried using that function, but it throws a error like 'AdaptiveCard' does not contain a definition for 'FromJson'.


回答1:


As there is a Breaking changes from v0.5:

Package renamed from Microsoft.AdaptiveCards to AdaptiveCards

It seems that you have installed Microsoft.AdaptiveCards but AdaptiveCards.

To install AdaptiveCards, please mark Include prerelease checkbox in NuGet package manager:




回答2:


Apparently the documentation is outdated. The class is named AdaptiveCard now, without the last 's'.

So instead of:

var parseResult = AdaptiveCards.FromJson(card);

Use:

var parseResult = AdaptiveCard.FromJson(card);


来源:https://stackoverflow.com/questions/47068862/adaptivecard-does-not-contain-a-definition-for-fromjson-microsoft-bot-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!