Gotcha when downgrading ServiceStack.Redis to version 3

Update

It turns out that this is caused by a change of the default behaviour in NuGet 2.8 whereby it now picks the lowest patch version of a package dependency.

—-

You’re probably aware of the announcement that ServiceStack is no longer free from version 4, but if you’ve already installed it, and reflexively clicked the licence agreement, then you probably need to downgrade to the latest of v3.

I discovered the hard way that there’s a mismatch in the versions pulled down from NuGet.  Cryptically, this gives the following error message:

System.TypeLoadException : Method 'get_Db' in type 'ServiceStack.Redis.RedisNativeClient' from assembly 'ServiceStack.Redis, Version=3.9.71.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

If you run the command Install-Package ServiceStack.Redis -Version 3.9.71 then along with ServiceStack.Redis v3.9.71 NuGet pulls down ServiceStack.Common version 3.9.11, which is not compatible (I’ve confirmed this behaviour in a fresh solution).

To solve it, you need to explicitly install version 3.9.71 of ServiceStack.Common:

Install-Package ServiceStack.Common -Version 3.9.71

P.s. don’t forget to set the version constraints in your package.config file.

Advertisements