diff --git a/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveCardRenderer.cs b/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveCardRenderer.cs index 4437f461cf..baab94588f 100644 --- a/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveCardRenderer.cs +++ b/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveCardRenderer.cs @@ -92,10 +92,16 @@ public ResourceDictionary Resources // Wrap this to avoid Console applications to crash because of this : https://github.com/Microsoft/AdaptiveCards/issues/2121 try { +#if NET6_0_OR_GREATER + const string assembly = "AdaptiveCards.Rendering.Wpf.Net6"; +#else + const string assembly = "AdaptiveCards.Rendering.Wpf"; +#endif + var source = new Uri($"/{assembly};component/Themes/generic.xaml", + UriKind.RelativeOrAbsolute); var resource = new ResourceDictionary { - Source = new Uri("/AdaptiveCards.Rendering.Wpf;component/Themes/generic.xaml", - UriKind.RelativeOrAbsolute) + Source = source }; _resources.MergedDictionaries.Add(resource); }