I am using Visual Studio 2017. I just created a new ASP.NET Core 2.0 project. I was trying to use NuGet to pull in the latest StackExchange.Redis 1.2.6 (as of 9/3/2017).
However, once I do that, Visual Studio complains that there is a conflicted reference in one of my RedisResult variable. It said
Error CS0433 The type 'RedisResult' exists in both 'StackExchange.Redis.StrongName, Version=1.2.4.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46' and 'StackExchange.Redis, Version=1.2.6.0, Culture=neutral, PublicKeyToken=null' Server C:\git\Splash\Server\BackPlaneConnection\Channel.cs 19 Active
Then, I found out that I don't really need to manually add any NuGet package in order to use StackExchange.Redis in my ASP.NET Core 2.0 app. In fact, if I manually add a reference to a different version of StackExchange.Redis, it causes the resolve conflict that I showed above.
Checked the build output. The DLL is actually coming from C:\Program Files\dotnet\sdk\NuGetFallbackFolder\stackexchange.redis.strongname
I tried deleting stackexchange.redis.strongname but it somehow still download it to my personal nuget folder automatically.
It almost feels like ASP.NET Core 2.0 internally needs StackExchange.Redis 1.2.4.0 but this really doesn't make sense to me.
I don't have the same problem when using ASP.NET Core 1.1. Is there any way to let my ASP.NET Core 2.0 use the latest StackExchange.Redis from NuGet?
I added a conditional flag to the "StackExchange.Redis" package, that makes it work. I Tried this fix on two new projects on two machines. Don't ask me why it works tho.
I gave the same answer in my duplicate question
I just ran into a similar problem in a solution file with a number of projects in it. A nuget package had been added which contained a dependency to a *.StrongName.dll version of a package that was already included in one of the projects. Since it was a dependency, tracking down where the StrongName version was referenced was extremely difficult even though it appeared in the Object Browser. I was finally able to track it down using a PowerShell console to dig through all nuget project dependencies in all projects to find the source of the duplication:
Found the reason. It's because by default VS.NET 2017 turned on the "Allow NuGet to download missing packages". The build screen also mentioned that.
In my case, to completely avoid this problem, I need to do the following steps to resolve my problem.