Yashwanth
Yashwanth

Reputation: 31

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

I have tried creating an adaptive card, parsing it from json. As mentioned in https://learn.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'.

Upvotes: 1

Views: 714

Answers (2)

brunochaina
brunochaina

Reputation: 876

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);

Upvotes: 1

Gary Liu
Gary Liu

Reputation: 13918

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:

enter image description here

Upvotes: 4

Related Questions