Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restrict when we add binding redirects #10833

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Oct 22, 2024

Previously when updating a package in a packages.config scenario with an app.config file, we'd update or add binding redirects for all referenced assemblies. This was too heavy-handed, particularly when a user's app.config file only had a few binding redirects. We'd then add 20+ which wasn't really what they wanted.

Another approach would be to only update existing binding redirects, but ultimately the dependabot tool is meant to help address security vulnerabilities, which might mean updating a very specific transitive dependency and if a binding redirect wasn't added, this could lead to difficult to diagnose issues at runtime with an assembly mismatch.

So the approach taken here is twofold: (1) update any existing binding redirect, and (2) add new binding redirects, but only for the updated package.

This can look complex, but it's not too bad. A NuGet package can contain assemblies with any name, they don't have to match the name of the package, but thankfully all packages are extracted to a well-known location so to do the binding redirects, we simply look for all assemblies under that very specific path.

@brettfo brettfo added the L: dotnet:nuget NuGet packages via nuget or dotnet label Oct 22, 2024
@brettfo brettfo marked this pull request as ready for review October 22, 2024 22:06
@brettfo brettfo requested a review from a team as a code owner October 22, 2024 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant