Should JsonHttpClient be dependent on ServiceStack.Client?

I created a new project and added the JsonHttpClient nuget package.
I create a client like this:
IServiceClient client = new JsonHttpClient(“http://techstacks.io”);
I then get the following error:
"The type ‘IHasCookieContainer’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘ServiceStack.Client, Version=4.0.52.0, Culture=neutral, PublicKeyToken=null’.

If JsonHttpClient is dependent on servicestack.client shouldn’t that be included as a dependency in the nuget package?

Sounds like you have dirty dlls, I’d check the version of all your ServiceStack.Client NuGet packages to make sure you’re referencing the same v4.0.52.

Deleting your NuGet /packages folder, restarting VS + rebuilding the project will bring just the packages that are referenced and will be able to show which packages that are being referenced are not v4.0.52.

JsonHttpClients implements 3 interfaces. IServiceClient and IJsonServiceClient which are in ServiceStack.Interfaces.
And IHasCookieContainer which is in ServiceStack.Client. As far as I can see.

I found the IHasCookieContainer interface here:

Right, it’s in the ServiceStack.Client.dll which ServiceStack.HttpClient has a dependency on. Are you referencing v4.0.52 package for HttpClient?

Yes. When I get the ServiceStack.HttpClient from nuget ServiceStack.Client is not listed as a dependency and it is not downloaded.

The dependency is not listed here:
https://github.com/ServiceStack/ServiceStack/blob/master/NuGet/ServiceStack.HttpClient/servicestack.httpclient.nuspec

Yep thanks, I’ve just added it in this commit. You’ll need to manually reference ServiceStack.Client for v4.0.52.

Ok good, just wanted to make sure I was thinking correctly :slight_smile: Thanks for swift reply as always!

1 Like