For those of you who are not familiar with the term “Blazor”, Blazor is a single-page application (SPA) framework built on .NET that is based on C#, Razor, and HTML that runs in the web browsers (Client-side) via WebAssembly. Blazor was designed to simplify the task of building fast single-page applications. Blazor is still experimental and not yet officially released.
So now that we answered the very basic question about what is blazor, let’s try to answer most of the questions regarding Blazor.
Why would I use .NET for web development?
Using .NET in the browser offers many advantages that can help make web development easier and more productive:
How can you run .NET in a web browser?
Running .NET in the browser is made possible by a relatively new standardized web technology called WebAssembly. WebAssembly is a “portable, size- and load-time-efficient format suitable for compilation to the web.” Code compiled to WebAssembly can run in any browser at native speeds. To run .NET binaries in a web browser, we use a .NET runtime (specifically Mono) that has been compiled to WebAssembly
Does Blazor compile my entire .NET-based app to WebAssembly?
No, a Blazor app consists of normal compiled .NET assemblies that are downloaded and run in a web browser using a WebAssembly-based .NET runtime. Only the .NET runtime itself is compiled to WebAssembly.
Wouldn't the app download size be huge if it also includes a .NET runtime?
Not necessarily. .NET runtimes come in all shapes in sizes. Early Blazor prototypes used a compact .NET runtime (including assembly execution, garbage collection, threading) that compiled to a mere 60KB of WebAssembly. Blazor now runs on Mono, which is currently significantly larger. However, opportunities for size optimization abound, including merging and trimming the runtime and application binaries. Other potential download size mitigations include caching and using a CDN.
What features will Blazor support?
Can I use Blazor without running .NET on the server?
Yes, a Blazor app can be deployed as a set of static files without the need for any .NET support on the server.
Is this Silverlight all over again?
No, Blazor is a .NET web framework based on HTML and CSS that runs in the browser using open web standards. It doesn’t require a plugin, and it works on mobile devices and older browsers.
Does Blazor use XAML?
No, Blazor is a web framework based on HTML, CSS, and other standard web technologies.
Is WebAssembly supported in all browsers?
Yes, WebAssembly has achieved cross-browser consensus and all modern browsers now support WebAssembly.
Does Blazor work on mobile browsers?
Yes, modern mobile browsers also support WebAssembly.
Where did the name "Blazor" come from?
Blazor makes heavy use of Razor, a markup syntax for HTML and C#. Browser + Razor = Blazor!