← All recipes
Moderne licensed

Replace PlatformServices with AppContext

Recipe IDOpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UsePlatformAbstractionsReplacementArtifactOpenRewrite.Recipes.CSharp.Migration.Dotnet

Replaces Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationBasePath with System.AppContext.BaseDirectory. The PlatformAbstractions package was removed in .NET Core 3.0. Also removes the obsolete using directive.

Single recipecsharpdotnetmigrationProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UsePlatformAbstractionsReplacement

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet