There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Add ability to force adding assembly binding redirects for select assemblies in package
Currently when a package gets installed assembly binding redirects get added to config only if there are other assemblies in the application that were bound against an earlier version of the assembly in my package. However, an application using my package
could be referencing my assembly's identity in other ways, most notably from config (e.g. registering custom config sections, specifying custom types, etc).
This request is about allowing me as the package author to specify a list of assemblies should always have assembly binding redirects added (either in the nuspec file or maybe via some other manifest file).
For example, say there's an MVC 3 application that has a ~/Views/web.config file that registers a RazorHost config section. I use NuGet to install MVC 4 into my application, which adds the latest versions of the assemblies into bin. However, my application
doesn't work because at runtime it's trying to load the 3.0 section (as specified in config) but the loaded assembly is 4.0.
The easiest solution is to add an assembly binding redirect in the root web.config. It would be nice if NuGet would do that automatically.
Note 1: It would be impractical to scan the entire application (at least a Web Application) to try to smartly determine if there are any web.configs that are referencing assemblies in my package because there could be a large number of those config files to
scan. Using a list would be a lot more efficient.
Note 2: For assemblies in my package that are not on my list we probably would still want NuGet to do the reference scanning just in case something is referencing that assembly.