问题
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