Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fabio Milheiro 74 posts 136 karma points
    Oct 02, 2013 @ 12:22
    Fabio Milheiro
    0

    Same types in HtmlAgilityPack.dll and Umbraco.Forms.Reference.dll with same namespaces?

    We had the HtmlAgilityPack dll in our project and, after installing umbraco contour, some pages stopped working and here's the error:

    Error loading Razor Script Rss.cshtml
    c:\_Caxton Projects\UmbracoSite\CaxtonFxWebApplication\macroScripts\Rss.cshtml(33): error CS0433: The type 'HtmlAgilityPack.HtmlDocument' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\5fade731\eb206284\assembly\dl3\726df5e3\c420bb81_02bece01\Umbraco.Forms.References.DLL' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\5fade731\eb206284\assembly\dl3\2f108f3f\f5482141_caa7ce01\HtmlAgilityPack.DLL'

    Why would contour forms contain an HtmlAgilityPack namespace with so many classes with the same name as the original HtmlAgilityPack in Umbraco.Forms.References.dll?

  • Comment author was deleted

    Oct 03, 2013 @ 10:59

    It's to avoid conflicts so we used Ilmerge to merge our third party references...

    What I can do is provide you with a build that doesn't have these merged assemblies, get in touch with tg at umbraco dot com

    Cheers, Tim

  • Fabio Milheiro 74 posts 136 karma points
    Oct 03, 2013 @ 22:29
    Fabio Milheiro
    0

    Hi Tim,

    I appreciate the goal is a nobel one but we got into a conflict still.

    Thanks for being available to send me a different build but I don't think we'll need that. I deleted the HtmlAgilityPack.dll file as your dll contains all the types we need.

    My suggestion would be to have 3rd party dlls as they are, if you happen to be referencing a new version, then the web.config needs to be edited to include redirect bindings so that the dll that is referencing the old one will start expecting the newer version.

    After Contour was installed this was the second issue. The first one was that System.Web.Mvc overwrote an older version and that's how I fixed the problem (added a redirect binding to the web.config so that all dlls referencing the System.Web.Mvc would now be looking for that same version.

    Cheers,
    Fabio

     

  • Russell McGinnis 48 posts 183 karma points
    Oct 07, 2014 @ 23:24
    Russell McGinnis
    0

    Tim, any progress on this issue. I have been evaluating Contour 3.0.21 in a test project with great success but as soon as I try and install it into my real project, that has the HtmlAgilityPack already referenced, it will not install and breaks the site.

  • Ricardo 24 posts 56 karma points
    Oct 16, 2014 @ 14:24
    Ricardo
    0

    I have the same problem with the HtmlAgilityPack.dll and still looking for a solution.

  • Comment author was deleted

    Oct 16, 2014 @ 14:40

    Will be fixed in Contour 4.0, beta coming this month, no more third party references that are merged into a single assembly

  • Ricardo 24 posts 56 karma points
    Oct 16, 2014 @ 16:03
    Ricardo
    0

    Found a work around here: http://issues.umbraco.org/issue/CON-100

    WORK AROUND:

    (1) in VS, go to the reference for HtmlAgilityPack, and right click > Properties.
    (2) change 'aliases' value to 'HtmlAgilityPack'
    (3) in your .cs file use: (for example)

    extern alias HtmlAgilityPack;
    using hap = HtmlAgilityPack::HtmlAgilityPack;
    ...
    var something = hap.HtmlWeb();


  • Russell McGinnis 48 posts 183 karma points
    Oct 16, 2014 @ 17:01
    Russell McGinnis
    1

    I did find an alternative solution, again suggested by someone on this forum, which was to place the code using the HtmlAgilityPack into a separate assembly rather than the App_Code folder. This was easy and convenient for me.

     

    Russell

Please Sign in or register to post replies

Write your reply to:

Draft