StackExchange.Redis.ID database exists in two DLLs

I installed Redis StackExchange nuget and everything works fine. But then I installed the RedisSessionStateProvider nuget which installed StackExchange.Redis.StrongName along with it.

Now I am getting the following error:

Error 107 Type 'StackExchange.Redis.IDatabase' exists in both 'E: \ Source \ packages \ StackExchange.Redis.1.0.481 \ Lib \ net45 \ StackExchange.Redis.dll' and 'e: \ Source \ packages \ StackExchange .Redis.StrongName.1.0.481 \ lib \ net45 \ StackExchange.Redis.StrongName.dll 'E: \ Source \ MyApp \ Helpers \ RedisHelper \ StackExchangeRedisExtensions.cs 13 37 MyApp

Why is this?

+3


source to share


3 answers


Some methods / properties / interfaces duplicated

in 2 slots.



Please remove the StackExchange.Redis link for troubleshooting.

+4


source


There is a lot of confusion between strong dll names and namespaces without strong names.

You can easily fix this problem using extern alias

.



  • Right click on the project references and select the DLL you want to upload, go to the properties window. Then change the field value Aliases

    to whatever you want. For example: "Redis".
  • Then go to your consumer source file and add:

    extern alias Redis;
    
    using System;
    // ... other references
    using Redis::StackExchange.Redis;
    
    namespace Foo
    {
        public class Program
        {
            public static void Main(string[] args)
            {
                using (ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("myConn"))
                {
                    // use StackExchange API here.
                }
            }
        }
    }
    
          

There is also an issue in the StackExchange repository explaining more about StrongName vs Non-StrongName.

+8


source


I ran into this issue in an ASP.NET Core application and this answer quickly solved my problem.

-1


source







All Articles