Blazor now in official preview!

Daniel Roth

Daniel

With this newest Blazor release we’re pleased to announce that Blazor is now in official preview! Blazor is no longer experimental and we are committing to ship it as a supported web UI framework including support for running client-side in the browser on WebAssembly.

A little over a year ago we started the Blazor experimental project with the goal of building a client web UI framework based on .NET and WebAssembly. At the time Blazor was little more than a prototype and there were lots of open questions about the viability of running .NET in the browser. Since then we’ve shipped nine experimental Blazor releases addressing a variety of concerns including component model, data binding, event handling, routing, layouts, app size, hosting models, debugging, and tooling. We’re now at the point where we think Blazor is ready to take its next step.

Blazor icon

Simplifying the naming and versioning

For a while, we’ve used the terminology Razor Components in some cases, and Blazor in other cases. This has proven to be confusing, so following a lot of community feedback, we’ve decided to drop the name ASP.NET Core Razor Components, and return to the name Server-side Blazor instead.

This emphasizes that Blazor is a single client app model with multiple hosting models:

  • Server-side Blazor runs on the server via SignalR
  • Client-side Blazor runs client-side on WebAssembly

… but either way, it’s the same programming model. The same Blazor components can be hosted in both environments.

Also, since Blazor is now part of .NET Core, the client-side Blazor package versions now align with the .NET Core 3.0 versions. For example, the version number of all the preview packages we are shipping today is 3.0.0-preview4-19216-03. We no longer use separate 0.x version numbers for client-side Blazor packages.

What will ship when

  • Server-side Blazor will ship as part of .NET Core 3.0. This was already announced last October.
  • Client-side Blazor won’t ship as part of the initial .NET Core 3.0 release, but we are now announcing it is committed to ship as part of a future .NET Core release (and hence is no longer an “experiment”).

With each preview release of .NET Core 3.0, we will continue to ship preview releases of both server and client-side Blazor.

Today’s preview release

New features in this preview release:

  • Templates updated to use the .razor file extension
  • _Imports.razor
  • Scope components with @using
  • New component item template
  • New Blazor icons
  • Blazor support in Visual Studio Code

Check out the ASP.NET Core 3.0 Preview 4 announcement for details on these improvements. See also the Blazor release notes for additional details on this preview release.

Get the Blazor preview

To get started with the Blazor preview install the following:

  1. .NET Core 3.0 Preview 4 SDK (3.0.100-preview4-011223)
  2. The Blazor templates on the command-line:

    dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview4-19216-03
    
  3. Visual Studio 2019 Preview with the ASP.NET and web development workload selected as well as the latest Blazor extension from the Visual Studio Marketplace, or Visual Studio Code with the latest C# extension (now with Blazor support!).

You can find getting started instructions, docs, and tutorials for Blazor at our new Blazor home page at https://blazor.net.

Blazor home page

Upgrade to the Blazor preview:

To upgrade your existing Blazor apps to the new Blazor preview first make sure you’ve installed the prerequisites listed above then follow these steps:

  • Update all Microsoft.AspNetCore.Blazor.* package references to 3.0.0-preview4-19216-03.
  • Remove any package reference to Microsoft.AspNetCore.Components.Server.
  • Remove any DotNetCliToolReference to Microsoft.AspNetCore.Blazor.Cli and replace with a package reference to Microsoft.AspNetCore.Blazor.DevServer.
  • In client Blazor projects remove the <RunCommand>dotnet</RunCommand> and <RunArguments>blazor serve</RunArguments> properties.
  • In client Blazor projects add the <RazorLangVersion>3.0</RazorLangVersion> property.
  • Rename all _ViewImports.cshtml files to _Imports.razor.
  • Rename all remaining .cshtml files to .razor.
  • Rename components.webassembly.js to blazor.webassembly.js
  • Remove any use of the Microsoft.AspNetCore.Components.Services namespace and replace with Microsoft.AspNetCore.Components as required.
  • Update server projects to use endpoint routing:
// Replace this:
app.UseMvc(routes =>
{
    routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}");
});

// With this:
app.UseRouting();

app.UseEndpoints(routes =>
{
    routes.MapDefaultControllerRoute();
});
  • Run dotnet clean on the solution to clear out old Razor declarations.

Blazor community page is now Awesome Blazor

As part of updating the Blazor site, we’ve decided to retire the Blazor community page and instead direct folks to the community driven Awesome Blazor site. Thank you Adrien Torris for maintaining this truly “awesome” list of Blazor resources!

Try out preview Blazor UI offerings from Telerik, DevExpress, and Syncfusion

Blazor benefits from an active and supportive community that has contributed all sorts of sample apps, components, and libraries to the Blazor ecosystem. Recently popular component vendors like Telerik, DevExpress, and Syncfusion have joined in the fun and shipped previews of Blazor UI components. We encourage you to give these Blazor UI offerings a try and let them know what you think.

Give feedback

We hope you enjoy this latest preview release of Blazor. As with previous releases, your feedback is important to us. If you run into issues or have questions while trying out Blazor, file issues on GitHub. You can also chat with us and the Blazor community on Gitter if you get stuck or to share how Blazor is working for you. After you’ve tried out Blazor for a while please let us know what you think by taking our in-product survey. Click the survey link shown on the app home page when running one of the Blazor project templates:

Blazor survey

Thanks for trying out Blazor!

77 comments

Comments are closed. Login to edit/delete your existing comments

  • Avatar
    Dharmraj

    Hello Roth,I can see the future, it would be the new era of web development by this amazing feature and invention of Blazor. Its really nice and i am sure most of i.t. proffessionals will move to use Blazor for making SPA.Also please solve my prob,Using: visual studio code + latest C# extension. OS: windows 10 – 64biti have made .net core app wit blazor, this throws error while i build the app [appname: CodeCoreBlazor]:Error:
    C:\Program Files\dotnet\sdk\3.0.100-preview6-012264\Microsoft.Common.CurrentVersion.targets(4552,5): error MSB3027: Could not copy “D:\TestProjects\New folder\CodeCoreBlazor\obj\Debug\netcoreapp3.0\CodeCoreBlazor.exe” to “bin\Debug\netcoreapp3.0\CodeCoreBlazor.exe”. Exceeded retry countof 10. Failed. [D:\TestProjects\New folder\CodeCoreBlazor\CodeCoreBlazor.csproj]
    C:\Program Files\dotnet\sdk\3.0.100-preview6-012264\Microsoft.Common.CurrentVersion.targets(4552,5): error MSB3021: Unable to copy file “D:\TestProjects\New folder\CodeCoreBlazor\obj\Debug\netcoreapp3.0\CodeCoreBlazor.exe” to “bin\Debug\netcoreapp3.0\CodeCoreBlazor.exe”. The process cannot access the file ‘D:\TestProjects\New folder\CodeCoreBlazor\bin\Debug\netcoreapp3.0\CodeCoreBlazor.exe’ because it is being used by another process. [D:\TestProjects\New folder\CodeCoreBlazor\CodeCoreBlazor.csproj]
    The build failed. Fix the build errors and run again.Please solve my prob, i have done much r&d on internet, not getting the solution. Thanks.

    • Daniel Roth
      Daniel RothMicrosoft employee

      Hi Dharmraj. Thanks for trying Blazor! It looks like the build failed because the the app is currently running and as a result the binaries are locked. Make sure the app isn’t running and then try building again.

  • Avatar
    Dharmraj

    Hey roth, is it possible to make progressive web app with blazor??  
     If not, then please make it possible, so that blazor can be bomb blastic and extreme competeiter to react, angular and other spa frameworks.  Thanks.

    • Daniel Roth
      Daniel RothMicrosoft employee

      Hi Parimal. Blazor is still in preview. Support for Blazor Server Apps is shipping with .NET Core 3.0 later this year in September. Support for Blazor WebAssembly Apps will ship some time later (exact date still to be determined). We have announced publicly that .NET support for WebAssembly will be part of the .NET 5 release late next year.

  • Avatar
    Dzmitry Salodki

    Please explain me difference with .net 1.1 silverlight wpf and blazor. Is it new bluff?

    • Daniel Roth
      Daniel RothMicrosoft employee

      Hi Dzmitry,

      While Blazor shares some similarities with Silverlight in that both are technologies that let you run .NET in a web browser, they have several key differences:

      – Blazor is based on WebAssembly, an open web standard and doesn’t require a browser plugin

      – Blazor’s UI model is based on HTML & CSS instead of XAML

      – Blazor is an open source and community based project. Even if Microsoft were to lose interest in the community can continue to carry it forward.

      I hope this helps!

      Daniel Roth

  • Avatar
    Suhail Ahamed

    Hi Daniel Roth.
    is Blazor ready to use now? Can we start the new web application in .net core 3 with Blazor ? or still need time to start.

    • Daniel Roth
      Daniel RothMicrosoft employee

      Hi Suhail.

      Support for Blazor Server apps is shipping with .NET Core 3.0 later this month. Be sure to join us for the release announcement at .NET Conf!

      Blazor WebAssembly support is not shipping with .NET Core 3.0, but we are continuing to work on it in parallel and we hope to share more details on its exact roadmap soon.