.NET 6 is launched and it is a LTS launch which suggests it’s going to be absolutely and actively supported for the subsequent 3 years. If you happen to’ve been paused ready for the appropriate time to improve to .NET 6, it is a good time to make the transfer!
Proper now, Hanselman.com and Hanselminutes.com (my podcast) are working on some model of .NET 5. You’ll be able to se by visiting them and scrolling to the very backside within the footer as I’ve added a git commit hash and Azure DevOps Construct Quantity and Construct ID to an ASP.NET web site and I am utilizing RuntimeInformation.FrameworkDescription to output the plain textual content model of .NET I am utilizing. This weblog is on .NET Core 3.0 which is an LTS launch however I will be working with Mark Downie this week to maneuver it to .NET 6 LTS as he is already acquired his occasion of dasBlog working on 6!
OK, let’s examine what’s concerned. Let’s begin with my podcast website. I’ve acquired the code on GitHub and working domestically with “dotnet run” on the command line in each Linux and Home windows. I can run the “dotnet improve assistant” which is nice, however I additionally prefer to drive stick shift typically for smaller tasks.
I will replace my TargetFramework in my csproj mission file from net5.0 to net6.0 and replace the foremost PackageReferences from 5.0.0 to six.0.0. It compiles.
Optionally, I will additionally run “dotnet outdated” which is one in all my favourite instruments. You will need to ensure you have a stable check suite and never simply do that with out testing.
I see that a few of these are main modifications so I can do a diff of those packages with quite a lot of instruments, however my favourite is FuGet.org (Thanks Frank!) so I can do a diff between the alpha model of Selenium I am utilizing and the launched see that the RemoteLogs sort is now known as Logs.
I may even replace my Dockerfile and alter variations like this
FROM mcr.microsoft.com/dotnet/sdk:6.0 as construct
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
I will verify that these photos construct and check. I additionally run my assessments optionally inside a container in order that’s good.
A few of my websites use Azure DevOps and others use GitHub Actions. Each use YAML (yay) to handle their config, so I will replace my UseDotNet activity in Azure DevOps YAML to model: “6.0.x”
I will commit and begin constructing within the cloud!
Modifications to be dedicated:
(use "git restore --staged <file>..." to unstage)
$ git commit -m "improve to .web 6"
I may even verify that my Azure App Service is about to .NET 6, however that is solely wanted if I am NOT working in a Docker Container or if I am NOT utilizing a self-contained executable.
Now I repeat this for my podcast and most important website and I am now on .NET 6! The weblog (a bigger improve) is subsequent.
Sponsor: Lob’s developer-friendly APIs make it simple to ship a letter, test, or postcard, as simply as e-mail. Design dynamic HTML templates to personalize mail for optimum affect. Begin Exploring with Postman!
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, marketing consultant, father, diabetic, and Microsoft worker. He’s a failed stand-up comedian, a cornrower, and a ebook writer.