Add a target-scoped reference for a resolved transitive NuGet dependency

Proprietary

Add an explicit package version only for one literal target framework when its original MSBuild graph proves the exact older transitive dependency. Retain existing references and unknown target/central package policy; preserve all other targets and package groups. An exact-project, explicitly reviewed opt-in can add a central VersionOverride when no captured pin or conflicting policy exists.

OpenRewrite.CSharp.Recipes.AddNuGetReferenceForTransitiveDependency

Required

Exact package identity.

Exact originally resolved stable version.

Newer stable version to reference explicitly.

One exact literal target framework.

Optional

RegenerateMarkerBoolean

Finalize the changed build graph. Compositions can finalize once after all additions.

Optional exact captured relative .csproj path; required for reviewed central overrides. No globs.

CentralPolicyAndDependencyPinsReviewedBoolean

Allow a target-scoped VersionOverride only in the exact selected CPM project after reviewing all imports, override policy and the complete dependency closure. Defaults to false. Known conflicting references, pins or policy remain excluded.

mod run . --recipe=OpenRewrite.CSharp.Recipes.AddNuGetReferenceForTransitiveDependency \ -P PackageName=System.Net.Http \ -P ExistingVersion=4.3.0 \ -P NewVersion=4.3.4 \ -P TargetFramework=netstandard1.1

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.