The Blazor WebAssembly Release Candidate is here! This release contains all of the features and improvements that we expect to release for the upcoming Blazor WebAssembly release. There are no more breaking changes planned at this point. Please give the Blazor WebAssembly Release Candidate a try and let us know what you think!
Here’s what’s new in this release:
- Custom boot resource loading
- API reference docs
Get started
To get started with Blazor WebAssembly 3.2.0 Release Candidate, install the latest .NET Core 3.1 SDK.
NOTE: Version 3.1.201 or later of the .NET Core SDK is required to use this Blazor WebAssembly release! Make sure you have the correct .NET Core SDK version by running
dotnet --versionfrom a command prompt.
Once you have the appropriate .NET Core SDK installed, run the following command to install the updated Blazor WebAssembly template:
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-rc1.20223.4
If you’re on Windows using Visual Studio, we recommend installing the latest preview of Visual Studio 2019 16.6. 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.
That’s it! You can find additional docs and samples on https://blazor.net.
Upgrade an existing project
To upgrade an existing Blazor WebAssembly app from 3.2.0 Preview 5 to the 3.2.0 Release Candidate:
- Update all Microsoft.AspNetCore.Components.WebAssembly.* package references to version 3.2.0-rc1.20223.4.
- Update any Microsoft.AspNetCore.Components.WebAssembly.Runtime package references to version 3.2.0-rc1.20222.2 (having a reference to this package is uncommon).
- Update all System.Net.Http.Json package references to 3.2.0-rc1.20217.1
You’re all set!
Custom boot resource loading
When a Blazor WebAssembly app loads in the browser, it first downloads all of the required boot resources from the server, including the .NET runtime, the bootstrapping JavaScript code, locale specific data, and the .NET assemblies that make up the app. You can now customize how these boot resources are loading using the loadBootResource API. You can use this API to make any needed modifications to how these specific outbound requests are constructed. For example, you might want to load some of the resources from an external CDN. Although Microsoft does not currently host the Blazor framework files on any specific public Content Delivery Network (CDN), you are free to add them to your own CDN if you wish. For example, if you have published the _framework\wasm files to a CDN within the base URL https://mycdn.example.com/blazorwebassembly/3.2.0-rc1/, then you could configure your application to use those resources as follows:
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
<script>
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
console.log(`Will load '${type}' with name '${name}' from URI '${defaultUri}' and integrity '${integrity}'`);
switch (type) {
case 'dotnetjs':
case 'dotnetwasm':
case 'timezonedata':
return `https://mycdn.external.cdn/blazorwebassembly/3.2.0-rc1/${name}`;
}
// Other types are 'assembly' and 'pdb' but you probably wouldn't want to fetch those from a CDN as they would be custom-linked for your app
// By returning undefined for other types, we let the framework use its normal strategy for those types
}
});
</script>
If you want to customize more than just the URLs that are being used, then your loadBootResource function can call fetch directly and return the result. For example:
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
<script>
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
// Adds a custom HTTP header to the outbound requests
// To retain the default integrity checking behavior, it's necessary to pass through the 'integrity' parameter
return fetch(defaultUri, {
cache: 'no-cache',
integrity: integrity,
headers: { 'MyCustomHeader': 'My custom value' }
});
}
});
</script>
API reference docs
API reference docs for the Blazor WebAssembly namespaces (Microsoft.AspNetCore.Components.WebAssembly.*) are now available in the .NET API browser as part of the ASP.NET Core 3.1 API docs.
Known issues
-
When publishing a ASP.NET Core hosted Blazor WebAssembly app using Visual Studio, satellite assemblies from the client application do not get copied to the publish folder.
This issue will be addressed in the upcoming release. To workaround this issue, publish the app from the command line using
dotnet publish.
Feedback
This is our last planned preview release of Blazor WebAssembly 3.2! We need your help to make sure that we’ve addressed any remaining blocking issues for the upcoming release. Please give it a try and let us know what you think by filing issues on GitHub.
We hope you enjoy the Blazor WebAssembly Release Candidate and thanks for trying out Blazor!
Hi,
We have some integrity issues when using our on premise (not cloud based) Azure DevOps Server pipelines. The integrity issue is only with the DLLs.
As an example
<code>
Please see also Blazor WebAssembly 3.2.0 breaks integrity of DLLs
A Visual Studio publish is fine on my local machine (although we did not test the access from another machine). Also accessing "locally" from the server to which we have deployed (using the pipelines) is fine. I even tried to use the same options when doing the publish from VS, i.e. "runtime Portable" which seemed to be the only big difference.
Here's the YAML for the...
** UPDATE **
Hi,
I tried to access my deployment done with VS publish from another machine. The issue exists. Does someone know what could be the root cause?
Thanks
Hi,
After investigation we have found the root cause. Our IT dept has set up special rules in the anti-virus. It’s blocking all DLL downloads.
See New Blazor WebAssembly 3.2, Dll files are blocking by the antivirus sophos
Thanks
Good day!
In previous article
https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-6/
there were some instructions concerning corrections in ASP.NET Core 3.0 project: Before / After (UseClientSideBlazorFiles, MapFallbackToClientSideBlazor etc.). This time, having some problems with Blazor templates in RC, I need analogical instructions for migration from Preview 6 to WebAssembly 3.2.0 Release Candidate. Please, add explanation into Upgrade an existing project block — key steps in correction of ASP Web-server (for Blazor-WASM). Also any link to fresh sources (RC) of Weather Forecast sample could be helpful.
Thanks!
Hi Sergei. It probably would be easiest to create new Blazor WebAssembly app with the latest release and then compare the template code with what you have to figure out what migration steps you might still be missing.
Good day, Daniel!
Naturally, what you are proposing is the first that comes into mind. But…
1. Here it this post I am talking about Server project for WASM-Client. Therefore “wasmblazor”-sample template does not help. Yes, it is fresh (Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-rc1.20223.4"), but it contains WASM-Client only.
2. Usage of complex sample named “blazorhosted” (Client+Server+Shared) leads to some strange result, on two different machines with .NET Core 3.1.4 and SDK 3.1.202. On the first machine I have, as it seems to me, something very old (Include="Microsoft.AspNetCore.Blazor.Server" Version="0.7.0" in server project). On the second computer with fresh .NetCore+SDK — “blazorhosted”-sample template does...
Hi Sergei. Please note that Blazor WebAssembly has now shipped as part of the latest .NET Core 3.1 SDK: https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-now-available/. The version of the SDK you need is 3.1.300, which you can install from here: https://dotnet.microsoft.com/download. If you have the correct version of the SDK, you don't need to separately install the Blazor WebAssembly template anymore - it's included with the SDK. Once you've installed the correct version of the SDK, you can verify that it installed correctly by running , which should return "3.1.300". With 3.1.300, you should be able to create a new ASP.NET Core hosted Blazor WebAssembly...
Hello guys.
Thanks for a great product. I have two requests for the further releases:
- Run your Code Analysis and nullable enabled and fix your templates before they make it into Visual Studio. I get a long list of warnings that I'm not sure of the effect if i fix them. Better you decide what to fix and what to supress that so that compilation is free from warnings as a baseline to start with.
- Make all scaffolded code (for example the ASP.NET Identity pages) localizable from start using the IStringLocalizer. Its a great advantage if we can...
Hi Stefan. Thanks for this feedback! To make sure this gets appropriately tracked by the team, please submit this feedback as a GitHub issue here if you haven’t already: https://github.com/dotnet/aspnetcore/issues.
Good Morning Daniel,
I'm having issues with the PWA - Integrity Check.
I'm using the latest version: 3.2.0.
I've noticed that several people have this issue with the Integrity Check, and there is already tickets created on github, its 'bug' on the blazor or its just some of us that didnt manage to do it right ? or what are the solutions ?
For me to bypass this situation im changing the code for: .map(asset => new Request(asset.url)) to bypass integrity .
I'm trying first on my machine before deploying to the server machine to be easy to debug any...
Hi Dionisio. This error can happen for various reasons. The first thing to verify is that the files deployed are exactly the same as the files that were built and published. If they are modified in any way when publishing, then the file hash will change and the integrity check will fail. For example, we've seen some cases where newline characters in the files were getting modified for specific publishing flows. But this error can also happen when the file fails to download. For example, maybe the file wasn't published at all or something is blocking the download of the...