New Blazor WebAssembly capabilities in .NET 6

dotnet · 99K views · 2021 · 29:11

Open on YouTube

Web developmentSoftware architecture & designtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it as the canonical demo of running native code and SQLite in Blazor WebAssembly, and as a reference when questions touch .NET 6 features.

Recommended by 4 people across 2 different months, 2019 to 2022.

What it is

A .NET Conf 2021 talk by Steve Sanderson on what .NET 6 adds to Blazor WebAssembly. It covers native dependencies (such as SQLite or a Rust library compiled to WASM), AOT compilation for near-native speed, smaller bundles, and hot reload, demonstrated with the BlazeOrbital sample app.

What people said

Strong rec Trygve · 2019-11 · Stack Overflow · on “Add client side Blazor to existing ASP.NET MVC5 app”

EDIT 2022-08-18: I haven't tested this myself, but this should now be possible by leveraging web components. Can we consume a Blazor component as a Web Component within a regular non-Blazor HTML page? [LINK] [this video] (I recommend the whole video by the way, excellent content!) Having an existing ASP.NET MVC5 app which is not feasible to rewrite all in one go, how can we start incorporating (client-side) Blazor to replace parts of that app? EDIT: We would need to have pages where parts of it are MVC5 and other parts are Blazor where this would work seamless for the end user. From what I have found so far the best (and only?) option would be to host Blazor in a different site and include it as

Recommends SmartE · 2021-11 · Stack Overflow · on “Can Blazor WebAssembly call another WASM module directly?”

This should be achieved much more easily with .NET 6 as Blazor now supports native dependencies. You can compile the OpenCV C++ or OpenCV.js to wasm using emscripten and add a native file to your csproj as shown below. <NativeFileReference Include="path-to-output-file" /> You can then go ahead and P/Invoke into the native code. In this [this video] , Steve Sanderson demos a very similar scenario. You can also check out the docs [LINK] on Native Dependencies in Blazor for more information.

Recommends rishabh kumawat · 2021-11 · Stack Overflow · on “Sqlite with Blazor (.NET 5) -> System.DllNotFoundException: e_sqlite3 but OK with Windows Forms”

In .NET 5 you can't use SQLite with Blazor in web app/browser. However, as of .NET 6, you can include native dependencies in Blazor WebAssembly. Inside dotnet conf 2021 they even show show that. It's working very nicely. You can see this in action here: Steven Sanderson on Blazor WebAssemby @ .NETConf21 [this video] (approx. 30 minutes watch time). A code sample for the above is available on Steve Sanderson's GitHub repo [LINK] .

Recommends m-smith · 2021-11 · Stack Overflow · on “How to use SQLite in Blazor WebAssembly?”

You can see this in action here: Steven Sanderson on Blazor WebAssemby @ .NETConf21 [this video] (watch time ~30mins)

Cites metsman · 2022-01 · Stack Overflow · on “What is the Benefit of using SQLite with Blazor WASM?”

I was watching this video from Steve Sanderson which demonstrates using SQLite with Blazor Web Assembly [this video] and I am contemplating using it in one of my projects. I am just trying to understand what the benefit is. It seems, from whatever information I was able to find, that the actual SQLite database resides in memory. In his project he is synchronizing it with IndexedDB for persistence. If that is the case, how is that better than storing your data as an object list in memory, and using Linq to query the objects directly, instead of Entity Framework to query from the SQLite database? You can also persist your objects to IndexedDB if that is required. I was never under the impression th

Cites VivekDev · 2022-02 · Stack Overflow · on “Blazor error Could not find NativeFileReference”

I am watching this Steve Sanderson's Video titled New Blazor WebAssembly capabilities in .NET 6 [this video] . I Cloned the git hub repo [LINK] and tried to build the BlazeOrbital solution inside of it [LINK] . I am getting the following errors Severity Code Description Project File Line Suppression State Error Could not find NativeFileReference ..\rustqr\target\wasm32-unknown-emscripten\debug\librustqr.a BlazeOrbital.ManufacturingHub C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.1\Sdk\WasmApp.Native.targets 228 Severity Code Description Project File Line Suppression State Error MC3066 The type reference cannot find a public type named 'Inventory'. Line 12 Position 51. B

Cites fingers10 · 2022-03 · Stack Overflow · on “How to use SQLite in Blazor WebAssembly?”

Starting .Net 6 , it is now possible to use SQLite with Blazor Web Assembly . Here are the steps, Add reference to following Nuget packages: Microsoft.EntityFrameworkCore.Sqlite SQLitePCLRaw.bundle_e_sqlite3 - Currently in preview as of posting this answer. This package is to avoid NativeFileReference of e_sqlite3.o . Add the following in .csproj to avoid unwanted warning from popping out. <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <EmccExtraLDFlags>-s WARN_ON_UNDEFINED_SYMBOLS=0</EmccExtraLDFlags> Add the following code in Program.cs . This is required to avoid runtime exception - Could not find method 'AddYears' on type 'System.DateOnly' public partial class Program { /// <summary> /// FI

Cites Tyson Gibby · 2022-12 · Stack Overflow · on “The specified deps.json does not exists in .NET 6”

@PanagiotisKanavos "You can't use EF on a browser." this is incorrect. Using EF on the client side (browser) is one of the new features of .NET 6 as bricelam has indicated. [this video] and [LINK] are good references.