Blazor WebAssembly 3.2.0 Preview 4 release now available - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Programming (https://www.sickgaming.net/forum-76.html) +--- Forum: C#, Visual Basic, & .Net Frameworks (https://www.sickgaming.net/forum-79.html) +--- Thread: Blazor WebAssembly 3.2.0 Preview 4 release now available (/thread-94601.html) |
Blazor WebAssembly 3.2.0 Preview 4 release now available - xSicKxBot - 04-17-2020 Blazor WebAssembly 3.2.0 Preview 4 release now available <div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available.jpg" width="150" height="150" title="" alt="" /></div><div><div class="row justify-content-center"> <div class="col-md-4"> <div><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available.jpg" width="58" height="58" alt="Daniel Roth" class="avatar avatar-58 wp-user-avatar wp-user-avatar-58 alignnone photo"></p> <p>Daniel</p> </div> </div> </div> <div class="entry-meta"> <p>April 16th, 2020</p> </p></div> <p><!-- .entry-meta --> </p> <p>A new preview update of Blazor WebAssembly is now available! Here’s what’s new in this release:</p> <ul> <li>Access host environment during startup</li> <li>Logging improvements</li> <li>Brotli precompression</li> <li>Load assemblies and runtime in parallel</li> <li>Simplify IL linker config for apps</li> <li>Localization support</li> <li>API docs in IntelliSense</li> </ul> <h2>Get started</h2> <p>To get started with Blazor WebAssembly 3.2.0 Preview 4 install the latest <a href="https://dotnet.microsoft.com/download/dotnet-core/3.1">.NET Core 3.1 SDK</a>.</p> <blockquote> <p>NOTE: Version 3.1.201 or later of the .NET Core SDK is <strong>required</strong> to use this Blazor WebAssembly release! Make sure you have the correct .NET Core SDK version by running <code>dotnet --version</code> from a command prompt.</p> </blockquote> <p>Once you have the appropriate .NET Core SDK installed, run the following command to install the updated Blazor WebAssembly template:</p> <pre><code>dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview4.20210.8 </code></pre> <p>If you’re on Windows using Visual Studio, we recommend <a href="https://visualstudio.com/preview">installing the latest preview of Visual Studio 2019 16.6</a>. For this preview you should still install the template from the command-line as described above to ensure that the Blazor WebAssembly template shows up correctly in Visual Studio and on the command-line.</p> <p>That’s it! You can find additional docs and samples on <a href="https://blazor.net">https://blazor.net</a>.</p> <h2>Upgrade an existing project</h2> <p>To upgrade an existing Blazor WebAssembly app from 3.2.0 Preview 3 to 3.2.0 Preview 4:</p> <ul> <li>Update all Microsoft.AspNetCore.Components.WebAssembly.* package references to version 3.2.0-preview4.20210.8.</li> <li>Update any Microsoft.AspNetCore.Components.WebAssembly.Runtime package references to version 3.2.0-preview5.20210.1</li> <li>Replace package references to Microsoft.AspNetCore.Blazor.HttpClient with System.Net.Http.Json and update all existing System.Net.Http.Json package references to 3.2.0-preview5.20210.3.</li> <li> <p>Add <code>@using System.Net.Http.Json</code> to your <em>_Imports.razor</em> file and update your code as follows:</p> <table> <thead> <tr> <th>Microsoft.AspNetCore.Blazor.HttpClient</th> <th>System.Net.Http.Json</th> </tr> </thead> <tbody> <tr> <td><code>GetJsonAsync</code></td> <td><code>GetFromJsonAsync</code></td> </tr> <tr> <td><code>PostJsonAsync</code></td> <td><code>PostAsJsonAsync</code></td> </tr> <tr> <td><code>PutJsonAsync</code></td> <td><code>PutAsJsonAsync</code></td> </tr> </tbody> </table> <p>Calls to <code>PostAsJsonAsync</code> and <code>PutAsJsonAsync</code> return an <code>HttpResponseMessage</code> instead of the deserialized response content. To deserialize the JSON content from the response message, use the <code>ReadFromJsonAsync<T></code> extension method: <code>response.content.ReadFromJsonAsync<WeatherForecast>()</code>.</p> </li> <li> <p>Replace calls to <code>AddBaseAddressHttpClient</code> in <em>Program.cs</em> with <code>builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });</code>.</p> </li> </ul> <p>You’re all set!</p> <h2>Access host environment during startup</h2> <p>The <code>WebAssemblyHostBuilder</code> now exposes <code>IWebAssemblyHostEnvironment</code> through the <code>HostEnvironment</code> property, which surfaces details about the app environment (Development, Staging, Production, etc.) during startup. If the app is hosted in an ASP.NET Core app, the environment reflects the ASP.NET Core environment. If the app is a standalone Blazor WebAssembly app, the environment is specified using the <code>blazor-environment</code> HTTP header, which is set to Development when served by the Blazor dev server. Otherwise, the default environment is Production.</p> <p>New convenience extension methods on <code>IWebAssemblyHostEnvironment</code> make it easy to check the current environment: <code>IsProduction()</code>, <code>IsDevelopment()</code>, <code>IsStaging()</code>. We’ve also added a <code>BaseAddress</code> property to <code>IWebAssemblyHostEnvironment</code> for getting the app base address during startup when the <code>NavigationManager</code> service isn’t yet readily available.</p> <h2>Logging improvements</h2> <p>The <code>WebAssemblyHostBuilder</code> now exposes a <code>Logging</code> property of type <code>ILoggingBuilder</code> that can be used to configure logging for the app, similar to how you would configure <a href="https://docs.microsoft.com/aspnet/core/fundamentals/logging">Logging in an ASP.NET Core app</a> on the server. You can use the <code>ILoggingBuilder</code> to set the minimum logging level and configure custom logging providers using extension methods in the <code>Microsoft.Extensions.Logging</code> namespace.</p> <h2>Brotli precompression</h2> <p>When you publish a Blazor WebAssembly app, the published and linked output is now precompressed using Brotli at the highest level to further reduce the app size and remove the need for runtime compression. ASP.NET Core hosted apps seamlessly take advantage of these precompressed files. For standalone apps, you can configure the host server to redirect requests to the precompressed files. Using the precompressed files, a published Blazor WebAssembly is now 1.8MB, down from 2MB in the previous preview. A minimal app without Bootstrap CSS reduces to 1.6MB.</p> <h2>Load assemblies and runtime in parallel</h2> <p>Blazor WebAssembly apps now load the assemblies and runtime in parallel saving some precious milliseconds off the app load time.</p> <h2>Simplify .NET IL linker config for apps</h2> <p>You can optionally <a href="https://docs.microsoft.com/aspnet/core/host-and-deploy/blazor/configure-linker?#control-linking-with-a-configuration-file">provide a .NET IL linker config file</a> for a Blazor WebAssembly app to customize the behavior of the linker. Previously, specifying a linker config file for your app would override the customizations built into Blazor that are necessary for apps to function property. App specific linker configuration is now treated as additive to the linker configuration provided by Blazor.</p> <h2>Localization support</h2> <p>Blazor WebAssembly apps now support localization using .NET resource files (.resx) and satellite assemblies. Blazor WebAssembly apps set the current culture using the user’s <a href="https://developer.mozilla.org/docs/Web/API/NavigatorLanguage/languages">language preference</a>. The appropriate satellite assemblies are then loaded from the server. Components can then be localized using the ASP.NET Core localization APIs, like <code>IStringLocalizer<TResource></code> and friends. For more details on localizing Blazor WebAssembly apps, see <a href="https://docs.microsoft.com/aspnet/core/blazor/globalization-localization">Globalization and localization</a>.</p> <h2>API docs in IntelliSense</h2> <p>The API docs for the various Blazor WebAssembly APIs are now available through IntelliSense:</p> <p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available.png"> <img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available.png" alt="API docs in IntelliSense"></a></p> <h2>Known issues</h2> <h3>Debugging limitations</h3> <p>Thank you everyone who has been trying out the new Blazor WebAssembly debugging support and sending us your feedback! We’ve made some progress in this release, but there are still a number of limitations with the current debugging experience in Visual Studio and Visual Studio Code. The following debugging features are still not yet fully implemented:</p> <ul> <li>Inspecting arrays</li> <li>Hovering to inspect members</li> <li>Step debugging into or out of managed code</li> <li>Full support for inspecting value types</li> <li>Breaking on unhandled exceptions</li> <li>Hitting breakpoints during app startup</li> </ul> <p>We expect to continue to improve the debugging experience in future releases.</p> <h2>Help improve the Blazor docs!</h2> <p>We’ve received a some feedback from the in-product Blazor survey that the Blazor docs could use some improvement. Thank you for this feedback! We know that docs are a critical part of any software development framework, and we are committed to making the Blazor docs as helpful as we can.</p> <p>We need your help to understand how to best improve the Blazor docs! If you’d like to help make the Blazor docs better, please do the following:</p> <ul> <li> <p>As you read the Blazor docs, let us know where we should focus our efforts by telling us if you find a topic helpful or not using the helpfulness widget at the top of each doc page:</p> <p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available-1.png"> <img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available-1.png" alt="Doc helpfulness"></a></p> </li> <li> <p>Use the Feedback section at the bottom of each doc page to let us know when a particular topic is unclear, inaccurate, or incomplete.</p> <p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available-2.png"> <img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/04/blazor-webassembly-3-2-0-preview-4-release-now-available-2.png" alt="Doc feedback"></a></p> </li> <li> <p>Comment on our <a href="https://github.com/dotnet/aspnetcore/issues/20890">Improve the Blazor docs</a> GitHub issue with your suggestions for new content and ways to improve the existing content.</p> </li> </ul> <h2>Feedback</h2> <p>We hope you enjoy the new features in this preview release of Blazor WebAssembly! Please let us know what you think by filing issues on <a href="https://github.com/dotnet/aspnetcore/issues">GitHub</a>.</p> <p>Thanks for trying out Blazor!</p> </div> https://www.sickgaming.net/blog/2020/04/16/blazor-webassembly-3-2-0-preview-4-release-now-available/ |