Convert static Main entry point to top-level statements
Recipe ID
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.ConvertMainToTopLevelStatementsArtifactOpenRewrite.Recipes.CSharp.Migration.DotnetConverts a class Program { static Main(...) { ... } } entry point to C# 9 top-level statements: the body of Main is lifted to the file level and the Program class and any enclosing namespace are removed. Scoped to the unambiguous single-type/single-Main case.
Single recipecsharpdotnetmigrationtop-level-statementsProprietary
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.Net5.ConvertMainToTopLevelStatementsIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet