Issue with having both PdfViewerServer.Windows and PdfViewerServer.Linux installed

Hello,


I have a small problem. We have a team of developers working in Windows on Blazor Server application. The application itself runs on a linux server. I have installed both the PdfViewerServer.Windows and PdfViewerServer.Linux packages.

When both are installed, I get these errors and the PDF viewer does not work

Exception thrown: 'System.DllNotFoundException' in Syncfusion.PdfViewer.AspNet.Core.dll

Exception thrown: 'System.TypeInitializationException' in Syncfusion.PdfViewer.AspNet.Core.dll

However, if I remove the .Linux package the PDF viewer works properly when running on Windows.

Is there any way to have both installed and have the application determine which package to use so it works properly whether its running on linux or windows?

Thanks!


3 Replies

VV Visvesvar Venkatesan Syncfusion Team October 20, 2022 12:11 PM UTC

Hi Matthew,


You can install the Blazor PDF Viewer packages automatically based on the operating system by adding all the PDF Viewer NuGet packages in your .csproj file as like the below code snippet and on building the same it will install the NuGet based on the operating system.


Code Snippet:


<ItemGroup>


    <PackageReference Include="Syncfusion.Blazor.PdfViewerServer.Linux" Version="20.2.0.36" Condition="$([MSBuild]::IsOsPlatform('Linux'))"/>


    <PackageReference Include="Syncfusion.Blazor.PdfViewerServer.Windows" Version="20.2.0.36" Condition="$([MSBuild]::IsOsPlatform('Windows'))"/>


</ItemGroup>



Regards,

Visvesvar K V 



MA Matthew October 21, 2022 03:06 PM UTC

Awesome, thank you!



VV Visvesvar Venkatesan Syncfusion Team October 24, 2022 04:53 AM UTC

Hi Mathew,


Thank you for your update.



Regards,

Visvesvar K V 



Loader.
Up arrow icon