I would like to create a Custom TextRenderer for a project. I keep getting a CS0433 error when I try to use MarkedNet.Marked class. I started with how Microsoft did there Wpf TextRenderer, but don't know how to stop the error from happening.
private static TextBlock CreateControl(ScreenTextElement textElement, AdaptiveRenderContext context)
{
Marked marked = new Marked();
marked.Options.Renderer = new AdaptiveXamlMarkdownRenderer();
marked.Options.Mangle = false;
marked.Options.Sanitize = true;
string text = RendererUtilities.ApplyTextFunctions(textElement.Text, context.Lang);
string xaml = $"<TextBlock xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">{marked.Parse(text)}</TextBlock>
}";
Error CS0433 The type 'Marked' exists in both 'AdaptiveCards, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'Microsoft.MarkedNet, Version=1.0.13.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Thank you for your help.
The message is displayed becaused both Microsoft.MarkedNet and AdaptiveCards contain the same type with exactly the same namespaces and type name. You can specify an alias in your project settings for either AdaptiveCards or Microsoft.MarkedNet like this (*)
and then use the fully qualified name with alias prefix by defining a using
using Marked = myAlias::Microsoft.MarkedNet.Marked;
or by using the fully qualified type name directly
myAlias::Microsoft.MarkedNet.Marked marked = new myAlias::Microsoft.MarkedNet.Marked();
(*) If the assembly is directly referenced click the assembly reference instead