Skip to content

Warn when configuring binding redirects on .NET TFs #53099

@rainersigwald

Description

@rainersigwald

.NET (5+) doesn't use binding redirects in .exe.config files at runtime to resolve referenced assemblies--instead there's .deps.json and an improved runtime binding policy.

The SDK knows about binding redirects for .NET Framework targets, though, and MSBuild considers app.config as an input for binding resolution decisions.

The SDK could help users here by detecting build-time attempts to influence binding that won't have runtime effect and warning about them.

This came up when an internal partner team was porting and ran into warnings like

C:\Program Files\dotnet\sdk\10.0.103\Microsoft.Common.CurrentVersion.targets(2560,5): warning MSB3836: The explicit binding redirect on "System.Buffers, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" conflicts with an autogenerated binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" xmlns="urn:schemas-microsoft-com:asm.v1" />".

in a project that (now) targets only net8.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions