Problem

Microsoft ASP.NET Web API (RTM) references Newtonsoft.Json (>= 4.5.6) (AKA Json.net)

Twitterizer 2 references Newtonsoft.Json (=4.5.5)

You can’t have both Newtonsoft.Json (>= 4.5.6) AND Newtonsoft.Json (=4.5.5) NuGet packages installed in the same project.

That means you CAN’T have WebApi and Twitterizer in the same project.

Solution

You could create separate projects like I mentioned in this post or you can get the Twitterizer source from GitHub, change the Json.net reference, compile it and then reference that Twitterizer2.dll from your project instead of using the NuGet package. Here’s how to do the that:

Keep in mind:

  • Use this at your own risk. I haven’t tested it fully, but it seems to work alright after a couple of smoke tests.
  • Yeah, I could have contributed this back to GitHub, but I don’t have time right now and I’m sure they are already working on it. I needed it now and might deal with that later.

1. Go to Twitterizer on GitHub and get the source:

2. Open the Twitterizer2.sln file

3. Right click –> Manage NuGet Packages –> Update Json.net for each of the projects in the solution. Make sure you do them all!

4. Double check each of the Newtonsoft.Json references are 4.5.0.

5. Change compilation mode to Release and Build

6. Find the Twitterizer2.dll file copy the folder path:

7. Go back to the project where you referenced Twitterizer.

8. Remove your reference to Twitterizer NuGet package

9. Add a referenced to the newly created Twitterizer DLL

10. Add the Json.net 4.5.5 reference

11. Add a reference to Microsoft ASP.NET Web API (If you need it and if not already referenced)

I know it’s a pain to do all this, but it looks like the only option until Twitterizer updates to Json.net 4.5.5

Jon

Share