Skip to content

Run binding redirect generation during restore instead of build #102

@julealgon

Description

@julealgon

When using GeneratedBindingRedirectsAction with, say, the Overwrite option, this custom SDK will refresh the section after the project is built.

Needing to perform a build however makes the dependency upgrade process inherently incompatible with what dependabot does when creating NuGet update PRs, thus requiring extra manual steps to force the build and then append the web.config updates on top of the branch created by dependabot.

I did a quick investigation, and it appears that dependabot already performs a dotnet restore today as part of its process, which is useful for producing needed diffs on packages.lock.json files when using locked restore mode.

If this SDK could also tap into the same process as lock files do (run binding redirect updates on restore), it would naturally work with dependabot PRs and we would be able to merge those with zero manual intervention.

I wasn't sure whether or not it was possible to tap into the restore process from MSBuild, but it appears to be possible using BeforeTargets="Restore" and AfterTargets="Restore" as long as the project is leveraging SDK-style csproj.

Can this SDK be updated in such a way that it does the binding redirect regeneration step during restore instead of during build?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions