Copied to clipboard

Flag this post as spam?

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


  • Fernando Chilvarguer 2 posts 22 karma points
    Apr 16, 2014 @ 02:22
    Fernando Chilvarguer
    0

    Multiple versions of Json.net

    Hello all,

    I have Umbraco v6.1.6 (Assembly version: 1.0.5021.24867) installed and running.

    I noticed I have 2 different Json assemblies on the /bin directory of the application:

    Newtonsoft.Json.Net20.DLL and

    Newtonsoft.Json.Net.DLL

    I'm trying to use Json.Net on a brand new script file and as soon as I add:

    @using Newtonsoft.Json;

    And try to use the JsonConvert method it gives me the error below:

    c:\inetpub\wwwroot\MacroScripts\635332037414785257_aaa.cshtml(155): error CS0433: The type 'Newtonsoft.Json.JsonConvert' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\e22c2559\92c7e946\assembly\dl3\eaf1ce99\490bebab_9c17cf01\Newtonsoft.Json.Net20.DLL' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\e22c2559\92c7e946\assembly\dl3\e0166b8a\335e5988_cf2dcf01\Newtonsoft.Json.DLL'

    I tried removing the old version but the XSLT stops working. I tried removing the new version, the whole site stopped working (500 errors). 

    Trying to use Json on a script file should be a pretty common scenario. Has anyone had this problem? Any ideas on how to solve it?

    Thanks,

    Fernando

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Apr 16, 2014 @ 09:26
    Sebastiaan Janssen
    0

    I've never heard of the .Net20.DLL.. Not sure where that might've come from.

    Try adding this to web.config (in runtime\assemblyBinding):

    <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
    </dependentAssembly>
    
  • Fernando Chilvarguer 2 posts 22 karma points
    Apr 22, 2014 @ 00:57
    Fernando Chilvarguer
    0

    HI Sebastian,

    I tried your code but it did not work.

    I figured our there that DLL is coming from:

    http://our.umbraco.org/projects/developer-tools/xsltojson

    This project bundles the DLL. I'm going to dig into it to see if I can make it use the "normal" Json DLL.

    Thanks,

    Fernando

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies