dotnet / dotnet/sdk

Warn when configuring binding redirects on .NET TFs

Open
#53,099 0 comments 0 reactions 0 assignees View on GitHub
Area-NetSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

.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: "".`

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.