I was working on an old MVC4 project that was running on .NET 4. I couldn’t upgrade it to 4.5 because this app runs on a Windows 2003 server and .NET 4.5 doesn’t support Windows 2003. Thus, I was stuck targeting good old .net 4. Not the end of the world, or so I thought. I then went to upgrade Kendo UI for MVC by Telerik. I used the MVC 4 version of Kendo since I’m using MVC 4 and that’s just the logical thing to do. I built and got a warning that prevented me from using the Kendo.Mvc DLL.

The primary reference "Kendo.Mvc, Version=2014.2.716.440, Culture=neutral,
PublicKeyToken=121fae78165ba3d4, processorArchitecture=MSIL" could not be resolved
because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=4.5.0.0,
Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the
".NETFramework,Version=v4.5" framework. This is a higher version than the currently
targeted framework ".NETFramework,Version=v4.0"

Not Telerik’s Fault

I eventually gave up and put in a support ticket with Telerik. They were prompt with their reply, which was nice as I was stuck in the water. My attempts at fixing the issue didn’t work at all. I tried this and that, only to frustrate myself. I figured it was something I did, not necessarily a Kendo problem. In the end it wasn’t Kendo’s fault at all.

No More DLL Hell, Um, Sure, Microsoft

Remember how Microsoft touted “no more DLL hell in .NET?” Well, toss that out the window. The problem ended up being the Microsoft Windows Azure .NET SDK. According to Microsoft:

The root cause is with Azure SDK 2.3. The SDK install drops a .NET 4.5-targeted Newtonsoft.Json.dll in the C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\v2.3\ref folder. Unfortunately, this folder is registered as a global reference folder even for frameworks prior to .NET 4.5.

Nice, huh? This could affect more than just Kendo UI because it’s a global reference. So if you’re working in a mixed .NET environment, watch out for this sneaking “bug.” The way I fixed it was by removing Newtonsoft.Json.dll file from Program Files\Microsoft SDKs\Windows Azure.NET SDK\v2.3\ref\ folder, as stated in the workarounds. Hopefully you’ll hit this post if you’re searching for a solution to “Newtonsoft.Json” and “This is a higher version than the currently targeted framework” so you don’t have to go through the pain I did.