5

Upgrading a Blazor WebAssembly Azure Static Web App from .NET 5 to .NET 6

 3 years ago
source link: https://www.daveabrock.com/2021/06/15/upgrade-blazor-static-app-net-5-net-6/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
photo-1602212096437-d0af1ce0553e?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDIxfHxhc3Ryb25hdXR8ZW58MHx8fHwxNjIzNzk4NjIz&ixlib=rb-1.2.1&q=80&w=2000

Upgrading a Blazor WebAssembly Azure Static Web App from .NET 5 to .NET 6

In this post, I briefly discuss the process of upgrading a Blazor WebAssembly App from .NET 5 to .NET 6.

In the last year or so, I've been working on a Blazor WebAssembly project called Blast Off with Blazor. It's a Blazor WebAssembly app hosted on the Azure Static Web Apps service, which recently went GA. Right now, it consists of four small projects: an Azure Functions API project, a project for the Blazor WebAssembly bits, a project to share models between the two, and a test project.

I wanted to see how easily I could upgrade the Blazor project from .NET 5 to .NET 6. With .NET 6 now on Preview 4, it's evolved enough where I'm ready for an upgrade. I was hoping I could double-click the project file, change my client and test projects from net5.0 to net6.0, and be on my way. (I also know I was being very optimistic.)  

After upgrading the TFM, I was able to run the app successfully. Great. I started this app using .NET 5 and its mature API surface, so I didn't expect any issues there.  The interesting part is deploying it to Azure Static Web Apps. Azure Static Web Apps uses the Oryx build system and I wasn't too sure if it supported .NET 6 yet. It does, and it deployed to Azure Static Web Apps on the first try.

oryx-60.png

What about upgrading Azure Functions to .NET 6?

Recently, the Azure Functions team announced initial support of running Azure Functions on .NET 6. This currently requires running a preview release of Azure Functions Core Tools V4. So, I could get this working locally but the support won't come to Azure Static Web Apps until we get closer to .NET 6 GA in November 2021. I'll upgrade it then. For me, I'd rather upgrade the Blazor project so I can take advantage of things like hot reload, AOT, and JSON serialization improvements.

Consider subscribing to The .NET Stacks, my free weekly newsletter. I write about news and trends, interview community leaders, and catch you up fast. (No spam, ever, and unsubscribe whenever you want.)



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK