Table of Contents

Migrating .NET 4.8 code to .NET 10

How to migrate backend code (.cs files) from .NET Framework 4.8 to .NET 10

When it comes to converting .NET customizations, this is the at-a-glance view of extensibility point compatibility between DW9 and DW10:

Extensibility point Compatibility
Notifications 95%
Providers (e.g. PriceProvider, ProductIndexSchemaExtender, CheckoutHandler) 100%
Content modules (ContentModule) and settings (ContentModules_Edit.aspx) 100%/0%
DynamicWeb API 85%
Dynamicweb.Ecommerce API 90%
DynamicWeb Modules API (Forms, Datalist, etc.) 99%
DynamicWeb Core APIs (Caching, Database, Logging, etc.) 95%

The following extensibility points are obsolete and must be replaced:

Extensibility point Reason Replacement
UI Extensibility (Ribbonbar, Dashboard, Statistics, etc.) Dependent on DW9 UI New UI Extensibility
Item type editors (Items) Dependent on DW9 UI New UI Extensibility
FieldTypeProviders Dependent on DW9 UI New UI Extensibility
Pipeline-dependent notifications (Dynamicweb.Notifications.Standard.Application) .NET 4 runtime related IPipeline and Middleware
Web.config .NET 4 runtime related IPipeline and Middleware
Global.asax and Default.aspx .NET 4 runtime related IPipeline and Middleware

Upgrading from .NET Framework 4.8 to .NET 10 projects

There are several strategies for migrating C# code to .NET 10, many of which can be found in official Microsoft docs. A quick and effective strategy is simply creating new .NET 10 projects (.csproj style) for each legacy project in the solution and copying code one or more files at a time.

This strategy will work especially well for smaller projects:

  1. Change project to .NET 10
  2. Remove usage of System.Web - replace with Dynamicweb.Context
  3. Isolate or delete incompatible code
  4. Change to use PackageReference format for C# projects
  5. Update NuGet dependencies to latest 10.X.X packages
  6. Remove all usage of deprecated DynamicWeb APIs
  7. Remove all usage of deprecated .NET APIs
  8. Remove unused dependencies

Changing the project to .NET 10

There are two ways to change your project to .NET 10:

  1. Create a new project (RECOMMENDED)
    • Open the folder with the current project in VS Code
    • Rename .csproj to .csproj.old
    • Open a terminal in the project folder
    • Create a new project 'dotnet new classlib -f net10.0'
    • Add required packages
      • dotnet add package dynamicweb
      • dotnet add package dynamicweb.ecommerce
    • Build the project - 'dotnet build'
  2. Use the .NET Upgrade Assistant

For DW10 customizations, target .NET 10 directly.

To top