Showing posts with label twitterizer. Show all posts
Showing posts with label twitterizer. Show all posts

Thursday, August 16, 2012

How to reference Twitterizer 2 and Web API RTM in the same project: You have to manually update Twitterizer's Json.net reference

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:

image

2. Open the Twitterizer2.sln file

image

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

image

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

image

5. Change compilation mode to Release and Build

image

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

image

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

image

 

10. Add the Json.net 4.5.5 reference

image

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

image

 

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

Wednesday, August 8, 2012

Solution to the exception: "Updating 'Newtonsoft.Json 4.5.8' to 'Newtonsoft.Json 4.5.5' failed. Unable to find a version of 'Microsoft.AspNet.WebApi.Client' that is compatible with 'Newtonsoft.Json 4.5.5'." when trying to install the twitterizer NuGet package in Visual Studio 2012

I have the RTM of Visual Studio installed, but the WebApi NuGet RTM build isn’t available yet.  WebApi depends on Newtonsoft.Json and so does Twitterizer, but there is a version conflict.

image

 

Unfortunately the solution to this error: “Updating 'Newtonsoft.Json 4.5.8' to 'Newtonsoft.Json 4.5.5' failed. Unable to find a version of 'Microsoft.AspNet.WebApi.Client' that is compatible with 'Newtonsoft.Json 4.5.5'.” is to uninstall WebApi from the project and then install Twitterizer.

For now, until WebApi RTMs, you can’t have both twitterizer and WebApi installed in the same project.  You can easily just create another WebApi project that doesn’t need twitterizer.

Sorry for the hassle.  Should be fixed with WebApi RTMs.  Which should be soon.

Jon