-
Notifications
You must be signed in to change notification settings - Fork 648
FAQ
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.
.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.
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.
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.
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.
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.
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
Yes, a Blazor application can be deployed as a set of static files without the need for any .NET support on the server.
Yes! Blazor optionally integrates with ASP.NET Core to provide a seamless and consistent full-stack web development solution.
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.
To build your first Blazor web app check out our getting started guide.
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.
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.
No, Blazor is a web framework based on HTML, CSS, and other standard web technologies.
Yes, WebAssembly has achieved cross-browser consensus and all modern browsers now support WebAssembly
Yes, modern mobile browsers also support WebAssembly.
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).
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.
Yes, Blazor applications can call into JavaScript through JavaScript interop APIs.
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.
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.
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.