I am not sure about the nuget package to be included for the adaptive cards in version 4 bot application which is being migrated from version 3. The options available are AdaptiveCards nuget package and Microsoft.AdaptiveCards(both by Microsoft). In version 3 we had adaptiveCards(by AdaptiveCards) which we were using.
We were using the following nuget package for adaptive cards(by AdaptiveCards) Adaptive cards in our version 3 application, kindly help me with the nuget package to be used for version 4 of same application so that the changes to be done in the existing code could be minimal and time saving.
When I add the suggested package in v4 aplication and the adaptive cards methods, I get the error 'AdaptiveCards is obselete. Please use the overload that accepts the version parameter and specify the version your card requires.'
One of the methods from our Adaptive Cards Class:
//Create an adaptive card to show the SharePoint search result
public static Attachment SPSearchAdapativecard(string title, string summery, string actionUrl)
{
summery = summery.Replace("<c0>", "**");
summery = summery.Replace("</c0>", "**");
summery = summery.Replace("<ddd/>", "...");
AdaptiveCard card = new AdaptiveCard()
{
Body = new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text = title,
Weight = AdaptiveTextWeight.Bolder,
Size = AdaptiveTextSize.Medium,
Wrap=false,
Separator = false,
Color= AdaptiveTextColor.Accent
},
new AdaptiveTextBlock()
{
Text = summery,
Wrap=true,
Size = AdaptiveTextSize.Small
},
},
Actions = new List<AdaptiveAction>()
{
new AdaptiveOpenUrlAction()
{
Id = "moreInfoBtn",
Title= "More Info",
Url= new Uri(actionUrl)
}
}
};
// Create the attachment with adapative card.
Attachment attachment = new Attachment()
{
ContentType = AdaptiveCard.ContentType,
Content = card
};
return attachment;
}
If you look at Microsoft.AdaptiveCards
package on Nuget.org ( here ), you will see that it is old and Deprecated
. Last update is 17/09/2017
Then on AdaptiveCards
on Nuget : versions are from a few days ago, and initial version is 24/10/2017: this package is the successor of the previously mentioned package.
Moreover, if you look at the Bot Builder Samples on GitHub, there is one for Adaptive Cards here .
Look at the referenced packages:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.