SfPrfViewer for both Windows and Linux in one project/appication

The Blazor server-side SfPrfViewer is OS sensitive: https://blazor.syncfusion.com/documentation/pdfviewer/getting-started/features. One NugetPackage for Windows and another one for Linux. We are using Windows for development and Linux Docker containers for development and deployment: VS2022 (Windows debugging and Linux Docker)->GitLab (Linux Docker)->MS Azure (Linux Docker). Is it possible to use the Blazor server-side SfPrfViewer in our environment?


3 Replies

SK Sinthiya Kalimuthu Syncfusion Team September 27, 2022 11:11 AM UTC

Hi Andrey,


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,

Sinthiya K



AK Andrey Kuznetsov September 28, 2022 11:13 AM UTC

Hi,

I've added these two packages and now have this error:

Error CS0121 The call is ambiguous between the following methods or properties:

'Syncfusion.Blazor.SyncfusionBlazor.AddSyncfusionBlazor(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Syncfusion.Blazor.GlobalOptions>)' and

'Syncfusion.Blazor.SyncfusionBlazor.AddSyncfusionBlazor(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Syncfusion.Blazor.GlobalOptions>)'

in program.cs in line:

builder.Services.AddSyncfusionBlazor(options => { options.IgnoreScriptIsolation = true; });



SK Sinthiya Kalimuthu Syncfusion Team September 29, 2022 02:16 PM UTC

Hi Andrey,


Based on your shared information, we have validated your reported issue “ambiguous error throws from registering our Syncfsion blazor service in startup.cs” and we suspect that you are using both Syncfusion overall NuGet package (Syncfusion.Blazor) and individual NuGet package (Syncfusion.Blazor.PdfViewer) in your application. So, we suggest you use either a whole NuGet package or individual NuGet packages to resolve this issue.

Please refer to the below documentation for more details.

Documentation Links:
1. https://blazor.syncfusion.com/documentation/nuget-packages/#for-blazor-server-application

2. https://blazor.syncfusion.com/documentation/nuget-packages/#individual-nuget-packages-for-syncfusion-blazor-ui-components 


Could you please check the above information and get back to us with more details such as error call stack, details about our used NuGet packages, etc. if you still facing the issue or need further assistance?


Regards,

Sinthiya K


Loader.
Up arrow icon