Add framework reference

Proprietary

Adds a <FrameworkReference> to a .csproj if it isn't already present.

OpenRewrite.CSharp.Recipes.AddFrameworkReference

Required

The shared framework name to reference.

Optional

Optional glob: only add the framework reference when a <PackageReference> matching this glob is present in the project. Leave blank to always add.

RegenerateMarkerBoolean

Whether to re-run dotnet restore after the edit to refresh the project's MSBuildProject marker. Defaults to true. Composite recipes that chain multiple csproj-mutating steps may set this to false on intermediate steps and finalize once with EnsureCsprojAttestation.

mod run . --recipe=OpenRewrite.CSharp.Recipes.AddFrameworkReference \ -P FrameworkName=Microsoft.AspNetCore.App

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