New Blazor Wasm project .net8 throws Could not find 'Helpers.setDotNetHelper'
I created a new .net8 Blazor Wasm project and inserted only Blazor Barcode Scanner as described. Inserted the component in the Home.razor and got the following error:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not find 'Helpers.setDotNetHelper' ('Helpers' was undefined).
Error: Could not find 'Helpers.setDotNetHelper' ('Helpers' was undefined).
at https://localhost:7083/_framework/blazor.web.js:1:734
at Array.forEach (
I think you just need to add the following lines to wwwroot\index.html (for server side _Host.cshtml) before the closing body tag as mentioned in the doc:
I have the same problem and I added those lines. I will come back if I find the cause.
Update: you also have to install the package in the server and add the script tags to your _Host.cshtml file, not your index.html in the client. This is poorly explained in the docs. (Yes this is for WASM, not server side or combined)