Fix NuGet app/web.config assembly binding redirect updates#10110
Conversation
…/web.config files, they are now regcognised as updated files in the update checker job and will be committed in the pull request
…This prevents existing redirects from being duplicated if there is a case mismatch
…n order to handle the scenario where multiple redirects are defined for the same assembly (bad config)
…n order to handle the scenario where multiple redirects are defined for the same assembly (bad config)
…n order to handle the scenario where multiple redirects are defined for the same assembly (bad config)
|
Thank you for the contribution! Could you add some unit tests in the C# code to verify the new behavior? |
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
Show resolved
Hide resolved
|
@brettfo I've added three unit tests for the logic changes; is there anything else you want me to do here or anything I can do to help get this accepted? |
…8738-fix-nuget-assembly-binding-redirects
|
EDIT: Sorry, it was a linting error; fixed now.
|
|
@rhyskoedijk I've seen the "Central Directory corrupt" error a bit recently. The good news is that re-running that CI step usually fixes it. The bad news is that I have no idea what's going on. It seems to be the same test, but I can't figure out what's happening. I even set that test to run in a loop locally and it got to 400 iterations with no failure, so it must be something about the VM it's running in. |
|
Thanks so much @rhyskoedijk ! |

What are you trying to accomplish?
Fix issues #2225 and #8738.
Support for .NET Framework assembly binding redirects doesn't work as expected because the required changes to
app.config/web.configare missing from the dependency update pull request. Without these config changes, runtime errors occur in the projects due to the mismatched assembly versions.Changes:
app.configorweb.configfiles, the file changes are now included in the [dependency update] pull request. Previously these files were ignored.app.configorweb.confighas a<?xml ... ?>declaration, it is now preserved when NuGetUpdater.Core modifies the config file. Previously the declaration was removed when the config file was updated.PublicKeyTokenattributes are now compared case-insensitive to prevent existing redirects from being duplicated if there is a case mismatch between tools (e.g. NuGet.exe vs Visual Studio).Anything you want to highlight for special attention from reviewers?
Some C# unreferenced code was removed (for clarity).
How will you know you've accomplished your goal?
Dependabot will commit
app.config/web.configchanges when updating .NET Framework projects that use manual assembly binding redirects.Reproduction repository:
https://github.com/rhyskoedijk/dependabot-nuget-webconfig-assembly-binding-test
(Visual Studio .NET Framework 4.8 Web API template project, with a few package changes to reproduce the problem)
Dry-run command:
Dry-run output pre change:
Dry-run output post change:
Checklist