Skip to content

Allow generating Assembly Binding Redirects into specific project's app.config #2467

Open
@megafinz

Description

@megafinz

Description

I have a WPF Desktop Application which uses Prism and Ninject. There is main executable project and a bunch of class libraries that are loaded dynamically upon start (Ninject Modules).

One of those projects has a reference on Ninject.Extensions.Factory package, which has a reference on Castle.Core 3.2.0. I'd like to use the latest 3.x.x version, which is 3.3.3.

Obvious solution is to use assembly binding redirects. I can add them manually, but it appears that Paket can also deal with them.

Here's the problem. I might not be understanding binding redirection correctly, but anyway. CLR seems to process only those binding redirects that are specified in the main executable's app.config (which becomes AppName.exe.config upon build). Paket adds redirects to config files of the assemblies that use those specific packages that need redirection, and unfortunately those redirects are completely ignored by the runtime.

Repro steps

Here's small project that demonstrates the issue. Both projects are built into the same folder, and Ninject dynamically loads Ninject.Extensions.Factory.dll which is referenced by the second project. Binding redirection is turned on in the paket.dependencies, but it doesn't help. Manually adding binding redirect to main project's app.config fixes the issue.

BindingRedirectTest.zip

Expected behavior

I'd like Paket to be able to generate assembly binding redirects in a single specified project (which produces the main executable and whose app.config is used by CLR to process binding redirects). Or even in a list of specified projects in case solution has many executable-website-whatever projects.

Actual behavior

Paket generates assembly binding redirects in app.config's of all projects that reference the redirectable package directly or indirectly. In my case these binding redirects are useless since they are absent from the app.config of the executable.

Also Paket removes binding redirects that I added manually.

Known workarounds

Don't use redirect's in paket.dependencies at all and manually add them to app.config of the main executable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions