fsprojects / fsprojects/Paket

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

Open
#2,467 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

binding redirect enhancement
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the BindingRedirectTest.zip reproduction, its paket.dependencies, and the app.config files for both projects. Check how Paket selects projects and writes redirects, then verify that redirects reach the executable project's app.config, manual redirects are preserved, and the reproduction runs without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp, xml
Domain
build-system, desktop, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.