Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.
Daniel Roth edited this page May 29, 2019 · 20 revisions

Q: What is Blazor?

Blazor is a single page web app framework built on .NET that runs in the browser via WebAssembly.

To see Blazor in action check out Steve Sanderson’s prototype demo at NDC London.

Q: I'm new to .NET. What's .NET?

.NET is a free, cross-platform, open source developer platform for building many different types of applications (desktop, mobile, games, web). .NET includes a managed runtime, a standard set of libraries, and support for multiple modern programming languages: C#, F#, and VB. You can get started with .NET in 10 min.

Q: 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:

  • Stable and consistent: .NET offers standard APIs, tools, and build infrastructure across all .NET platforms that are stable, feature rich, and easy to use.
  • Modern innovative languages: .NET languages like C# and F# make programming a joy and keep getting better with innovative new language features.
  • Industry leading tools: The Visual Studio product family provides a great .NET development experience on Windows, Linux, and macOS.
  • Fast and scalable: .NET has a long history of performance, reliability, and security on the server. Using .NET as a full-stack solution makes it easier to scale your applications.

Q: 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.

Q: Does Blazor compile my entire .NET based app to WebAssembly?

No, a Blazor app consists of normal compiled .NET assemblies that get downloaded and run in a web browser using a WebAssembly based .NET runtime. Only the .NET runtime itself is compiled to WebAssembly. That said, support for full static ahead of time (AoT) compilation of the app to WebAssembly may be something we add further down the road.

Q: 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, but 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.

Q: What features will Blazor support?

Blazor will support all of the features of a modern single page app framework:

  • A component model for building composable UI
  • Routing
  • Layouts
  • Forms and validation
  • Dependency injection
  • JavaScript interop
  • Live reloading in the browser during development
  • Server-side rendering
  • Full .NET debugging both in browsers and in the IDE
  • Rich IntelliSense and tooling
  • Publishing and app size trimming

Q: Can I use Blazor without running .NET on the server?

Yes, a Blazor application can be deployed as a set of static files without the need for any .NET support on the server.

Q: Can I use Blazor with ASP.NET Core on the server?

Yes! Blazor optionally integrates with ASP.NET Core to provide a seamless and consistent full-stack web development solution.

Q: Is Blazor a .NET port of an existing JavaScript framework?

Blazor is inspired by existing modern single page app frameworks, like React, Angular, and Vue, but is also a new framework in its own right.

Q: How can I try out Blazor?

To build your first Blazor web app check out our getting started guide.

Q: Is Blazor still experimental?

Blazor is now in official preview and is no longer experimental! Support for server-side Blazor will ship in .NET Core 3.0. Support for client-side Blazor on WebAssembly won't ship with .NET Core 3.0, but will ship some time later.

Q: 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 requires no plugin and works on mobile devices and older browsers.

Q: Does Blazor use XAML?

No, Blazor is a web framework based on HTML, CSS, and other standard web technologies.

Q: Is WebAssembly supported in all browsers?

Yes, WebAssembly has achieved cross-browser consensus and all modern browsers now support WebAssembly

Q: Does Blazor work on mobile browsers?

Yes, modern mobile browsers also support WebAssembly.

Q: What about older browsers that don't support WebAssembly? For example, does Blazor work in IE?

For older browsers that don't support WebAssembly, we recommend running Blazor with server-side execution. This produces the same interactive client-side application feel, but with your components executed on the server and events proxied over a socket connection. This removes all the heavy load from the browser and allows excellent performance and compatibility with even the oldest browsers. Please note however that the default Blazor project templates do not include all the polyfills needed for Internet Explorer or some other older browsers, so if you need to support them, you'll need to reference suitable polyfill JS libraries (example).

Q: Can I use .NET Standard libraries with Blazor?

Yes, the .NET runtime used for Blazor supports .NET Standard 2.0. APIs that aren't supported in the browser throw NotSupportedExceptions.

Q: Don't you need features like garbage collection and threading added to WebAssembly to make this work?

No, WebAssembly in its current state is sufficient. The .NET runtime handles its own garbage collection and threading concerns.

Q: Can I use existing JavaScript libraries with Blazor?

Yes, Blazor applications can call into JavaScript through JavaScript interop APIs.

Q: Can I access the DOM from a Blazor app?

You can access the DOM through JavaScript interop from .NET code. However, Blazor is a component based framework that minimizes the need to access the DOM directly.

Q: Why Mono? Why not .NET Core or CoreRT?

Mono is a Microsoft sponsored open source implementation of the .NET Framework. Mono is used by Xamarin for building native client apps for Android, iOS, and macOS and also by Unity for game development. Microsoft’s Xamarin team announced their plans to add support for WebAssembly to Mono and they have been making steady progress. Because Blazor is a client-side web UI framework targeted at WebAssembly, Mono is a natural fit.

By comparison, .NET Core is primarily used for server applications and for cross-platform console apps. .NET Core can be used for creating an ASP.NET Core backend for a Blazor app, but not for building the client app itself. CoreRT is a .NET Core runtime optimized for AoT compilation and while it has WebAssembly aspirations the project is still a work in progress and not a shipping product.

Q: Where does the name "Blazor" come from?

Blazor makes heavy use of Razor, a markup syntax for HTML and C#. Browser + Razor = Blazor! When pronounced, it is also the name of a swanky jacket worn by hipsters that have excellent taste in fashion, style, and programming languages.