The "PdfDocument" type is present in "Syncfusion.Pdf.Base and "Syncfusion.Pdf.Portable

In one of my classes, I am using the Syncfusion.Pdf package installed using the nuget-package installer, to create pdf documents using the Syncfusion.Pdf.PdfDocument class. This was working, until I also installed the Syncfusion.PdfViewer.WPF package in order to use the PdfViewer control in my WPF View. After installing the PdfViewer package with nuget, I get the following error:

CS0433 The "PdfDocument" type is present in "Syncfusion.Pdf.Base, Version=21.2.5.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" and "Syncfusion.Pdf.Portable, Version=21.2.5.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89".

I do not understand why this is happening, because I am not referencing the PdfViewer.WPF namespace in my pdfcreator class, so their should not be any conflicts when using the Syncfusion.Pdf.PdfDocument class.

Just as a side note, this error disappeared when I uninstalled the PdfViewer.WPF package from nuget, and then reappeared as soon as I reinstalled the PdfViewer.WPF package.

[EDIT] I went through the individual dependencies and discovered that the PdfViewer is installing one or more duplicates of existing ones that already came with the Syncfusion.Pdf.Net.Core package. I am now attempting to manually add the dlls to my project.



1 Reply

IJ Irfana Jaffer Sadhik Syncfusion Team May 19, 2023 10:48 AM UTC

If you plan to utilize the PdfViewer NuGet package "Syncfusion.PdfViewer.WPF" in your application, please take note of the screenshot below. It shows that NuGet already includes the dependency "Syncfusion.Pdf.Wpf" package. Consequently, it is necessary to uninstall the previously added Syncfusion.Pdf package from your project. Having multiple NuGet packages with similar dependencies can lead to ambiguity issues. We recommend uninstalling the Syncfusion.Pdf Package from your project and informing us about the outcome.


If you are still facing an issue, we request you to share the modified sample with us. So that we can assist with you further in this.


Loader.
Up arrow icon