System.DllNotFoundException: libHarfBuzzSharp in a Blazor WASM

Hello!

I am getting the error below when converting an Excel file to HTML in a Blazor WASM app.
The same code works in a regular .NET Core app.

System.DllNotFoundException: libHarfBuzzSharp

Is there something special that needs to be done for Gembox to work in a Blazor app?

Thank you.

Hi,

Besides installing GemBox.Spreadsheet, for Blazor WebAssembly, you’ll also need to include its native dependencies.
Please check the last snippet code on the following page:

Or use something like this:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="GemBox.Spreadsheet" Version="*" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="*" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="*" PrivateAssets="all" />
  </ItemGroup>

  <!-- Add HarfBuzzSharp and SkiaSharp native assets. -->
  <ItemGroup>
    <PackageReference Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="7.3.0" />
    <NativeFileReference Include="$(HarfBuzzSharpStaticLibraryPath)\3.1.34\**\*.a" />
    <PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.6" />
    <NativeFileReference Include="$(SkiaSharpStaticLibraryPath)\3.1.34\**\*.a" />
  </ItemGroup>

</Project>

I hope this helps.

Regards,
Mario