Skip to content

Add binding redirects to .config files. #245

Closed

Description

@isaacabraham

Paket should automatically add / update existing / delete old binding redirects to all .config (both app and web) files it locates after a restore or update operation.

Activity

  1. ilkerde commented on Oct 12, 2014

    @ilkerde

    Why?

  2. isaacabraham commented on Oct 12, 2014

    @isaacabraham
    ContributorAuthor

    To stop getting runtime errors? Let's say you have package A that has a dependency on package B v1.0. You get the latest version of Package B, v1.1. You run your application, it goes pop because package A is looking for v1.0 of Package B. You need to manually put a binding redirect in your configuration file to redirect the request for v1.0 to accept v1.1 instead.

    Or am I missing something here.

  3. agross commented on Oct 12, 2014

    @agross
    Contributor

    I have to admit I'm not very fond of adding redirects automatically. NuGet does that as well, and each time I see a config full of redirects it scares the crap out of me.

    I just converted a project from nuget to Paket and got rid of more than half of my redirects.

    Alex

    Alexander Groß
    Tiny phone, tiny mail

    On Sun, Oct 12, 2014 at 1:13 PM, Isaac Abraham [email protected]
    wrote:

    To stop getting runtime errors? Let's say you have package A that has a dependency on package B v1.0. You get the latest version of Package B, v1.1. You run your application, it goes pop because package A is looking for v1.0 of Package B. You need to manually put a binding redirect in your configuration file to redirect the request for v1.0 to accept v1.1 instead.

    Reply to this email directly or view it on GitHub:
    #245 (comment)

  4. isaacabraham commented on Oct 12, 2014

    @isaacabraham
    ContributorAuthor

    We should at least make this optional. I've already seen both projects that I've converted from nuget to paket go pop for exactly this reason.

  5. isaacabraham commented on Oct 12, 2014

    @isaacabraham
    ContributorAuthor

    The real problem is that MSBuild (and to a lesser exent) .NET in general has no notion of package dependency - the only item that you can reference is the assembly.

    So whilst I agree with you re: binding redirects looking scary - I think that they solve more problems than they cause. But again, IMHO.

  6. ilkerde commented on Oct 12, 2014

    @ilkerde

    @isaacabraham Fair enough. Binding redirects indeed solve problems. NTL, the user should have chance (and responsibility) to know and deal with such a "squiggling reference". I think it's a good thing if paket tries to be transparent on reference/contraint issues.

    I think paket should know about diverging version constraints towards package B. I want to reiterate this using your example, just to make sure I understood correctly.

    • You have dependency A (>0)
    • You have dependency B (>1.0)
    • You have transitive/indirect dependency A -> B (1.0).

    An update gets you B (1.1), whilst A keeps stable and requires (1.0). An assembly redirect is needed to overcome this situation.

    Presuming that the update operation is done using paket update, we could detect this situation and give the user feedback on it. I propose that neither update nor restore operations should automatically add/remove binding redirects but rather let the user know about it with warnings.

    For the sake of convenience, we could think about explicit opt-in within a --force operation (which I wouldn't like at all). An alternative option would be to introduce a command, i.e. paket patch --inter-reference-constraints.

    @agross @forki What's your opinion on that?

  7. agross commented on Oct 12, 2014

    @agross
    Contributor

    Yep, I think we should make it explicit. Maybe not only the patching but another command to check whether binding redirects are required in the first place.

    Alex

    Alexander Groß
    Tiny phone, tiny mail

    On Sun, Oct 12, 2014 at 2:06 PM, ilkerde [email protected] wrote:

    @isaacabraham Fair enough. Binding redirects indeed solve problems. NTL, the user should have chance (and responsibility) to know and deal with such a "squiggling reference". I think it's a good thing if paket tries to be transparent on reference/contraint issues.
    I think paket should know about diverging version constraints towards package B. I want to reiterate this using your example, just to make sure I understood correctly.

    • You have dependency A (>0)
    • You have dependency B (>1.0)
    • You have transitive/indirect dependency A -> B (1.0).
      An update gets you B (1.1), whilst A keeps stable and requires (1.0). An assembly redirect is needed to overcome this situation.
      Presuming that the update operation is done using paket update, we could detect this situation and give the user feedback on it. I propose that neither update nor restore operations should automatically add/remove binding redirects but rather let the user know about it with warnings.
      For the sake of convenience, we could think about explicit opt-in within a --force operation (which I wouldn't like at all). An alternative option would be to introduce a command, i.e. paket patch --inter-reference-constraints.
      @agross @forki What's your opinion on that?

      Reply to this email directly or view it on GitHub:
      Add binding redirects to .config files. #245 (comment)
  8. isaacabraham commented on Oct 16, 2014

    @isaacabraham
    ContributorAuthor

    I've started looking this - any reason why we're using XmlDocument and not XDocument for xml manipulation?

  9. isaacabraham commented on Oct 16, 2014

    @isaacabraham
    ContributorAuthor

    @ilkerde I would expect to at least have the option to make the process non-interactive with e.g. --force.

  10. forki commented on Oct 16, 2014

    @forki
    Member

    XmlDocument vs. Xdocument? No idea. Use whatever makes sense to you ;-)
    On Oct 16, 2014 10:54 PM, "Isaac Abraham" [email protected] wrote:

    I've started looking this - any reason why we're using XmlDocument and not
    XDocument for xml manipulation?

    —
    Reply to this email directly or view it on GitHub
    #245 (comment).

  11. isaacabraham commented on Oct 16, 2014

    @isaacabraham
    ContributorAuthor

    XDocument is much easier to use. At least, it was in my C# days :-)

  12. forki commented on Oct 16, 2014

    @forki
    Member

    Go for it. I'm just copying stuff from old projects...
    On Oct 16, 2014 10:59 PM, "Isaac Abraham" [email protected] wrote:

    XDocument is much easier to use. At least, it was in my C# days :-)

    —
    Reply to this email directly or view it on GitHub
    #245 (comment).

  13. isaacabraham commented on Oct 17, 2014

    @isaacabraham
    ContributorAuthor

    What's the best place for me to integrate the code in? I have something that will take in a config file and a binding redirection and apply it to the config file (if the redirection doesn't exist, it creates it, otherwise it overwrites the existing one with the new one).

  14. forki commented on Oct 18, 2014

    @forki
    Member

    I sounds very cool. We need to discuss the scenario. When do we want this
    to happen.
    On Oct 17, 2014 11:32 PM, "Isaac Abraham" [email protected] wrote:

    What's the best place for me to integrate the code in? I have something
    that will take in a config file and a binding redirection and apply it to
    the config file (if the redirection doesn't exist, it creates it, otherwise
    it overwrites the existing one with the new one).

    —
    Reply to this email directly or view it on GitHub
    #245 (comment).

  15. isaacabraham commented on Oct 18, 2014

    @isaacabraham
    ContributorAuthor

    @forki IMHO as soon as possible :-) The question is how to identify web.config and app.config files that are affected by a reference change.

  16. isaacabraham commented on Nov 9, 2014

    @isaacabraham
    ContributorAuthor

    We had a look at this during Prog F# hackathon, I'll see where the chap got to that was doing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions