N. Ma
N. Ma

Reputation: 629

New to C#/Mono, ServiceStack.Redis cannot find reference

I'm trying to build a console app to test out redis/mono communication. I've been hitting a brick wall using Monodevelop 4.0 (Xamarin Studios)+Nuget Port to work with ServiceStack.Redis on mac os.

All the solutions I've found online only say, change the ".Net 4.0 Client Profile" into ".Net 4.0 full" on visual studios. I haven't found a related function on MonoDevelop, not even sure if such an option exists. So no help there.

The error I am getting is:

"The type or namespace name `RedisClient' could not be found. Are you missing a using directive or an assembly reference?"

The screencap below shows the missing references, even though it is clearly in the reference folder :(. It is very puzzling.

Has anyone had a similar problem? Any help would be appreciated.

ScreenCap of Assemblies and References

Upvotes: 3

Views: 1233

Answers (3)

Matt Welch
Matt Welch

Reputation: 668

I was having this same issue with Xamarin Studio 4.0.12 + NuGet Port running against Mono 2.10.9.

Yesterday I decided to try to get OrmLite working & when I went to add the package, I saw that there were ServiceStack updates available (to version 3.9.66.0 from 3.9.63.0). Installed the updates and added the OrmLite package and I started getting the same error...

"The type or namespace name 'OrmLiteConnectionFactory" could not be found. Are you missing a using directive or an assembly reference?"

The weird part was Intellisense was working (I could fully qualify OrmLiteConnectionFactory in the IDE and it would find it fine) but it would not build. Just like you, I also saw in Assembly Browser that my ServiceStack DLLs were referencing previous versions of some of the other ServiceStack projects.

Upgrading to the latest Mono release (3.2.3 atm) solved the issue for me. Hallelujah! Not sure why I was using Mono 2.10.9 to begin with.

Upvotes: 1

Brian Chavez
Brian Chavez

Reputation: 8573

I think this is generally an issue with lagging version numbers on Mono.

For example, here's an example that can reproduce the issue:

  • Your ServiceStack.Redis is compiled against ServiceStack.Interfaces -> 3.9.45.
  • But you've actually pulled the latest 3.9.48 versions of:

    ServiceStack.Interfaces 3.9.48

    ServiceStack.Common 3.9.48

    ServiceStack.Text 3.9.48

Mono will have problems forwarding old ServiceStack references 3.9.45 to 3.9.48.

So, recompiling from source will resolve the issue.

Or, ensure all your references are using the same version number by opening up all ServiceStack.*.dll (as you've done) and ensure there are no lagging version number references.

ServiceStack.Redis

Similarly, I had a problem with ServiceStack.Logging.NLog compiled against 3.9.44 packages which lead to various TypeLoadExceptions on Mono when the head version of ServiceStack.* is 3.9.48.

Upvotes: 2

N. Ma
N. Ma

Reputation: 629

So after hair tearing fighting with the MonoDevelop IDE and nuget. I just resorted to building the Servicestack.redis from source in MonoDevelop, and copied over the output DLLs. This worked without a problem.

It seems either that monodevelop doesn't like the Dlls from nuget, or that the nuget port has some bugs with DLl references. Either way, I don't know the specifics, but there is a solution around it by building servicestack components from source in MonoDevelop.

Upvotes: 1

Related Questions