StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

Unable to use StackExchange.Redis_Net40 library in project targeting framework 4.0

Open nandakishorvh opened this issue 12 years ago • 8 comments

Hello everyone

When i reference StackExchange.Redis_Net40 in a new project which is targeting to 4.0 framework i get these following errors

"The type or namespace name 'StackExchange' could not be found (are you missing a using directive or an assembly reference?)"

and same error for ConnectionMultiplexer and IDatabase as well.

Please help

nandakishorvh avatar Jul 27 '14 19:07 nandakishorvh

I have the same problem

slimjack avatar Sep 23 '14 07:09 slimjack

Can you be very clear and explicit about what process you are going through here? For example, if I start a new .NET 4.0 application, then do

PM> install-package StackExchange.Redis

then NuGet "does its thing" (output shown below), and it just works; the following application compiles and runs successfully (assuming there is an available redis server)

using StackExchange.Redis;

namespace ConsoleApplication54
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var muxer = ConnectionMultiplexer.Connect("127.0.0.1"))
            {
                var db = muxer.GetDatabase();
                var latency = db.Ping();
                System.Console.WriteLine(latency.TotalMilliseconds);
            }
        }
    }
}

So; what are you doing differently? Are there any compilation warnings? Are you referencing Microsoft.Bcl and Microsoft.Bcl.Async? (if you use NuGet, this will all be done automatically)

NuGet output:

PM> install-package StackExchange.Redis
Attempting to resolve dependency 'Microsoft.Bcl (≥ 1.1.9)'.
Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.14)'.
Attempting to resolve dependency 'Microsoft.Bcl.Async (≥ 1.0.168)'.
Installing 'Microsoft.Bcl.Build 1.0.14'.
You are downloading Microsoft.Bcl.Build from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=329770. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Bcl.Build 1.0.14'.
Installing 'Microsoft.Bcl 1.1.9'.
You are downloading Microsoft.Bcl from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=329770. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Bcl 1.1.9'.
Installing 'Microsoft.Bcl.Async 1.0.168'.
You are downloading Microsoft.Bcl.Async from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=329770. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Bcl.Async 1.0.168'.
Installing 'StackExchange.Redis 1.0.333'.
Successfully installed 'StackExchange.Redis 1.0.333'.
Adding 'Microsoft.Bcl.Build 1.0.14' to ConsoleApplication54.
Successfully added 'Microsoft.Bcl.Build 1.0.14' to ConsoleApplication54.
Adding 'Microsoft.Bcl 1.1.9' to ConsoleApplication54.
Successfully added 'Microsoft.Bcl 1.1.9' to ConsoleApplication54.
Adding 'Microsoft.Bcl.Async 1.0.168' to ConsoleApplication54.
Successfully added 'Microsoft.Bcl.Async 1.0.168' to ConsoleApplication54.
Adding 'StackExchange.Redis 1.0.333' to ConsoleApplication54.
Successfully added 'StackExchange.Redis 1.0.333' to ConsoleApplication54.

mgravell avatar Sep 23 '14 09:09 mgravell

Sorry. I didn't try to use nuget package (I'm working now with StackExchange.Redis sources). Thanks for reply.

slimjack avatar Sep 24 '14 14:09 slimjack

OK; I'll try that later

mgravell avatar Sep 24 '14 15:09 mgravell

I'm having the exact same problem - I used the install-package StackExchange.Redis command, got the exact output as described above, but I get a compile error on the "Using StackExchange,Redis" line. The references to StackExchange.Redis are there, as well as references to the Microsoft.Bcl dependencies.

I'm in VS 2013 targeting .NET 4.0 framework. Intellisense recognizes StackExchange - ie: if I type in "StackExchange." it recognizes "Redis" and "Redis." recognizes the list under that, including ConnectionMultiplexer - but cannot compile "The type or namespace name 'StackExchange' could not be found (are you missing a using directive or an assembly reference?)" Qualifying the complete object does not work either - "StackExchange.Redis.ConnectionMultiplexer" - same error.

Help

Award4444 avatar Jun 02 '15 14:06 Award4444

Update the Microsoft.Bcl NuGet to version 1.1.10 manually should fix it.

MichaConrad avatar Jun 02 '15 14:06 MichaConrad

Thank You! That did the trick.

From: MichaC [mailto:[email protected]] Sent: Tuesday, June 02, 2015 8:38 AM To: StackExchange/StackExchange.Redis Cc: Tony Ward Subject: Re: [StackExchange.Redis] Unable to use StackExchange.Redis_Net40 library in project targeting framework 4.0 (#74)

Update the Microsoft.Bcl NuGet to version 1.1.10 manually should fix it.

— Reply to this email directly or view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/74#issuecomment-107975639 . https://github.com/notifications/beacon/AMIGkF49Q8lYas6PZkTKbcY5X_I--Bcsks5oPbc8gaJpZM4CRWDJ.gif

Award4444 avatar Jun 02 '15 14:06 Award4444

@nandakishorvh @Award4444 @slimjack Are you having this issue with current references, or all set on latest? Just following up on old issues here.

NickCraver avatar Jan 26 '16 01:01 NickCraver