Add framework reference
Recipe ID
OpenRewrite.CSharp.Recipes.AddFrameworkReferenceArtifactOpenRewrite.Recipes.CSharp.CoreAdds a <FrameworkReference> to a .csproj if it isn't already present.
Single recipeProprietary
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe OpenRewrite.CSharp.Recipes.AddFrameworkReference --recipe-option "FrameworkName=Microsoft.AspNetCore.App"If the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CoreOptions
| Name | Type | Description |
|---|---|---|
FrameworkNamerequired | String | The shared framework name to reference. e.g. Microsoft.AspNetCore.App |
TriggerPackageGlob | String | Optional glob: only add the framework reference when a <PackageReference> matching this glob is present in the project. Leave blank to always add.e.g. Microsoft.AspNetCore.* |
RegenerateMarker | Boolean | 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. |