Magnus Rahl
Feb 22, 2022
  9157
(12 votes)

Rolling out support for .NET 6

In September last year, we released the Optimizely DXP platform for the modern version of the Microsoft .NET platform - .NET 5 (formerly known as .NET Core). This release wave included CMS version 12 and Commerce version 14 as well as platform support in our DXP cloud service.

In November Microsoft released the new version of this modern track of .NET: .NET 6. We have of course also been getting questions about .NET 6 support in Optimizely products. And specifically, whether projects on older versions (CMS 11, Commerce 13) using .NET Framework 4.x should upgrade to .NET 5 or wait for .NET 6 (spoiler: No need to wait, but also the wait is soon over).

Backwards compatibility in .NET (Core)

To understand what to expect from upgrades to .NET 5 and 6 it helps to think about their origins: .NET 5 and 6 are iterations of .NET Core, with .NET 5 following .NET Core 3.1. You can use .NET Core libraries in .NET 5 applications as long as they are not affected by any of the breaking changes in .NET 5, which are relatively few from .NET Core 3.1.

The same goes for .NET 6, it has relatively few breaking changes from .NET 5 and can use .NET 5 (and .NET Core) libraries in the same way. For example, the Microsoft.Data.SqlClient package does not contain assemblies compiled for .NET 5 or 6, since its .NET Core 3.1 assembly runs without modification in .NET 5 and 6.

In contrast, the changes from .NET Framework 4.x to the modern .NET are more significant, but hardly any difference between going from 4.x to 5 and directly from 4.x to 6.

Preparing for .NET 6, prioritizing .NET 5

Even before we released our .NET 5 support, we did test upgrades of our core packages to the .NET 6 preview version. And we confirmed our expectation that there were no major changes required. Reassured by this, we focused our efforts on tooling to support upgrades of .NET Framework solutions (CMS 11 / Commerce 13), including the newly released preview of self-service migration tooling for our cloud platform, as well as continuing to convert additional packages and addons to .NET 5.

.NET 6 wave starts today!

Today we are also announcing the first wave of support for .NET 6. This consists of two pieces:

  • Version 12.4.0 of the CMS Core packages. Note that this is a minor version release, i.e. there are no breaking changes in our APIs. The package supports both .NET 5 and .NET 6 solutions through multi-targeting (including both .NET 5 and .NET 6 compiled assemblies).
  • DXP cloud service support for .NET 6 solutions. Similar to the software, the platform also supports both .NET 5 and .NET 6 applications, and will automatically choose the correct runtime for your deployment package.

There is a reason I call this the first wave, and I’ll be completely transparent: We haven’t updated (or otherwise verified compatibility) all Optimizely packages yet. We are updating more packages as dependencies become available. Quite a few are under way and confirmed to not have any incompatibilities (but some require updated dependencies e.g. on Microsoft packages). We will continue to release .NET 5/6 multi targeted packages for CMS UI, Commerce, Find and select other packages in the coming weeks.

Should I choose .NET 5 or .NET 6?

The CMS Core packages we release today are the only ones that we know are affected by a breaking change in .NET 6 and hence need a .NET 6 compiled assembly to run properly in all scenarios. As far as we know all other Optimizely packages that today support .NET 5 also support .NET 6 without changes other than dependencies.

Because of this, we chose to release the first packages now so that you, depending on what packages you use, can potentially get started with .NET 6. If you are using a specific Optimizely addon or even a 3rd party package that is only compiled for .NET 5 (or even .NET Core, and certainly .NET Standard) it will most likely run fine in .NET 6 already.

If are working on a project, new or an upgrade from .NET Framework, you can continue to target .NET 5. A later upgrade to .NET 6 is likely going to be minimal effort.

Using .NET 6 today

Or if you want to, you can target .NET 6 today. Depending on what packages you use it will be more or less tricky. This is a setup I used to run a CMS site in .NET 6 on DXP today:

<PackageReference Include="EPiServer.CMS" Version="12.3.1" />
<PackageReference Include="EPiServer.CloudPlatform.Cms" Version="1.0.3" />
<!-- Extra top level dependencies needed to force CMS 6 compatible version of CMS Core -->
<PackageReference Include="EPiServer.CMS.AspNetCore.HtmlHelpers" Version="12.4.0" />
<PackageReference Include="EPiServer.Hosting" Version="12.4.0" />
<!-- Extra top level dependencies needed until our CloudPlatform and AspnetIdentity packages are updated to declare .NET 6 dependencies -->
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" /> 
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />

As you can see a few extra explicit top level dependencies are required to force the right versions of everything. Fewer and fewer of these will be necessary as we release packages with updated dependencies. So waiting a few weeks will make this simpler.

Minimal API:s Limitation

[Added 2022-03-28]

Note that the new hosting API using `WebApplication` that was introduced together with MinimalAPIs in ASP.NET Core 6 is not supported at this time. This is due to the a change in setup order that comes with this model which causes some issues with the way the CMS Initialization Modules currently work. So for the time being you will be limited to using the standard hosting model that relies on a separate Startup class when building your CMS applications.

Related: Resolving dependency conflits

[Added 2022-03-30]

I also recommend reading this blog post on Resolving Nuget dependency conflicts in Project SDK (PackageReference) model.

Related: Detailed .NET 6 support status

[Added 2022-09-05]

I have heard some misconceptions about our .NET 6 support, probably relating to this gradual rollout method we chose. To clarify: All packages that include a .NET 6 target are of course tested in .NET 6 and officially support .NET 6. By now this includes all of the core platform plus the absolute majority of Optimizely maintained modules and addons. You can check the status of a specific package here.

Feb 22, 2022

Comments

Vincent
Vincent Feb 22, 2022 11:17 PM

Thanks for sharing this great news, Magnus! 

Sven-Erik Jonsson
Sven-Erik Jonsson Mar 25, 2022 07:44 AM

Having recently upgraded to .net6 on a Commerce solution my experience was that:

  • EPiServer.Framework.AspNetCore for .net5 is constrained on Microsoft.Extensions.DependencyInjection < 6.0.0, which causes issues with automatic dependency resolution leaving you jumping through hoops to get the packages to resolve cleanly. Optimizely should really consider removing or increasing that constraint.
  • EPiServer.CMS.Core (12.4.2) is dependent on SixLabors.ImageSharp >= 2.0.0 and implicitly ImageSharp.Web >= 2.0.0 (for blob storage and basic resizing). Just that ImageSharp.Web 2.0.0 isn't released yet and has to be added via SixLabors own nuget feed. I find it really strange that a core package has a hard dependency against a specific image processing solution.

Johan Petersson
Johan Petersson Mar 25, 2022 08:36 AM

We haven't release full support for .NET6 yet, only the CMS Core packages. Have you updated them explitly? For a smoother upgrade I would recommend waiting until our umbrella package, which also includes e.g. CMS UI, is updated to .NET6 as well.

Mari Jørgensen
Mari Jørgensen Mar 25, 2022 02:45 PM

@Johan, any ETA on the remaining packages?

Sven-Erik Jonsson
Sven-Erik Jonsson Mar 25, 2022 03:28 PM

Some clarifications:

  • I wrote that Microsoft.Extensions.DependencyInjection < 6.0.0 for .net5 causes an issue with dependency resolution when you upgrade to .net6, because not all of the packages have .net6 support yet and as you know, you probably have other dependencies in your project than just Optimizely nugets targeting a variety of supported platforms.
  • I also wrote that there was an implicit dependency on ImageSharp.Web since as you surely also know the site has to provide images to the public and sure, for arguments sake you could install another package along side it but you absolutely cannot run ImageSharp.Web < 2.0.0 with the current dependency set. This is one of Optimizelys own example sites: https://github.com/episerver/Foundation/blob/net5/src/Foundation/Foundation.csproj#L33.

Magnus Rahl
Magnus Rahl Mar 30, 2022 12:36 PM

@Mari CMS UI was released yesterday (as version 12.4.0). This unblocks a lot of other packages in the dependency chain. We have done some updates on several of those already, just waiting for the final version of CMS UI and getting them through regression testing. So hopefully we should see e.g. Commerce in a couple of weeks.

Scott Reed
Scott Reed Apr 22, 2022 08:38 AM

Is there any update on the commerce packages?

Magnus Rahl
Magnus Rahl Apr 28, 2022 05:21 PM

@Scott, Commerce is still in regression testing. So we are a bit behind where we thought we would be, but it is very close now.

Sven-Erik Jonsson
Sven-Erik Jonsson Apr 29, 2022 06:37 AM

  • "We will continue to release .NET 5/6 multi targeted packages for CMS UI, Commerce, Find and select other packages in the coming weeks."
  • "So hopefully we should see e.g. Commerce in a couple of weeks."

It is now over a month later, which is an order of magnitude greater than the quoted statements.
I would say that "So we are a bit behind..." is a gross understatement, especially as .NET 5 is nearing end of support.

Magnus Rahl
Magnus Rahl Apr 29, 2022 11:35 AM

@Sven-Erik. Thank you for your feedback. In the release cycle for .NET 6 we opted to release and communicate even though not everything is complete. On previous comparable events we've kept everything behind locks until we know we can do a coordinated release, and we didn't want to do that this time. With this of course comes uncertainty. But I can assure you teams are, and have been, working really hard to make this happen.

Scott Reed
Scott Reed May 13, 2022 10:22 AM

For anyone still interested looks like .NET 6 support came out today with 14.3.0 https://nuget.optimizely.com/package/?id=EPiServer.Commerce.Core&v=14.3.0

Sven-Erik Jonsson
Sven-Erik Jonsson May 18, 2022 07:51 AM

Looks like the package was either pulled or not available for all yet, all I get is ""

Scott Reed
Scott Reed May 18, 2022 07:52 AM

We upgraded and had a number of issues so I imagine it was rolled back.

Scott Reed
Scott Reed May 18, 2022 08:06 AM

https://world.optimizely.com/blogs/Erik-Skagerlind/Dates/2022/5/commerce-14-3-0-has-temporarily-been-removed-from-the-optimizely-nuget-feed/

Mari Jørgensen
Mari Jørgensen May 30, 2022 01:49 PM

I can see that 14.3.1 now has been released with .NET 6 support for Episerver.Commerce. Any ETA on Find-packages - when will they have .NET 6 support, @Magnus?

Magnus Rahl
Magnus Rahl Jun 3, 2022 08:15 AM

@Mari I apologize, we've had a lot of issues getting Find through our automatic testing due to reasons not related to the Find packages themselves. But it has now been cleared and should be in the release train on Tuesday.

Magnus Rahl
Magnus Rahl Jun 7, 2022 03:07 PM

@Mari Find packages were released today, version 14.1.0 supports .NET 6.

Please login to comment.
Latest blogs
Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Resize Images on the Fly with Optimizely DXP's New CDN Feature

With the latest release, you can now resize images on demand using the Content Delivery Network (CDN). This means no more storing multiple versions...

Satata Satez | Dec 19, 2024

Simplify Optimizely CMS Configuration with JSON Schema

Optimizely CMS is a powerful and versatile platform for content management, offering extensive configuration options that allow developers to...

Hieu Nguyen | Dec 19, 2024