Convert packages.config to <PackageReference>
OpenRewrite.CSharp.Recipes.ConvertPackagesConfigToPackageReferenceArtifactOpenRewrite.Recipes.CSharp.CoreMoves NuGet dependencies from packages.config into <PackageReference> items in the sibling project file, classifying top-level vs. transitive packages and reconstructing IncludeAssets/ExcludeAssets/PrivateAssets from the resolved dependency graph. Removes packaged <Reference>/<Import>/<Analyzer> wiring, the EnsureNuGetPackageBuildImports target and NuGetPackageImportStamp property, rewrites remaining packages/ folder paths to $(PkgXxx) properties, deletes packages.config, and flags package behaviors that PackageReference does not support (install.ps1, XDT config transforms, legacy content/ assets) for manual follow-up.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe OpenRewrite.CSharp.Recipes.ConvertPackagesConfigToPackageReferenceIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CoreOptions
| Name | Type | Description |
|---|---|---|
TrimTransitive | Boolean | Drop packages.config entries that are transitive dependencies of other entries instead of keeping them as explicit top-level pins. The restored package versions may drift over time as ranges re-resolve. Defaults to false. |