Table of Contents

Converting .NET customizations

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

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 NET4.X to NET8 projects

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

This strategy will work especially well for smaller projects:

  1. Change project to .NET 8
  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 9.15 or 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 Standard/.NET 8

There are two ways to change you project to .NET Standard or .NET 8:

  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 netstandard2.1'
    • Add required packages
      • dotnet add package dynamicweb
      • dotnet add package dynamicweb.ecommerce
    • Build the project - 'dotnet build'
  2. Use the .NET Upgrade Assistant

As soon as your project builds and runs on DynamicWeb 10, you should change the project to .NET 8 instead of .NET Standard.

To top