What is the difference between StackExchange.Redis and StackExchange.Redis.StrongName?

11,851

Solution 1

Do you need a strongly named Redis library? In all likelihood, especially if you never even encountered this term, the answer is no. But read on.

What is strongly named?

  • it's a .NET specific thing
  • you can choose to sign your assembly with a cryptographic key
  • this makes it possible to verify that you are actually loading/running something you expect to load/run
  • the "strong name" includes the cryptographic signature together with the the usual name, version and things like that.

Do you ever need strong names?

  • probably not unless you have specific reasons. Some of these may be:
  • historic (we used to sign our assemblies and why change now)
  • corporate policies
  • special circumstances such as something else you are using requires strong names (it used to be a requirement to have strong name if you wanted to add something to the GAC)
  • possibly security considerations

Is it a good idea to sign your assemblies?

  • there are a lot of divided opinions
  • very often strong names are a pain in so many ways with questionable benefits
  • it has been a trend lately to not use strong names unless you really must

Do you need a strongly named Redis library?

  • unless you decide or have to sign your own application which uses Redis library you don't
  • the strong names version of Redis library is identical to the other one
  • it exists solely for the reason to make lives of those who need to use strong names easier

Solution 2

Aside from the signed vs unsigned assemblies argument, the RedisSessionStateProvider has a dependency on StackExchange.Redis.StrongName

So if you want to use RedisSessionStateProvider, choose the StrongName version unless you want to have two dependencies.

Update: As @Matei_Radu has pointed out, Microsoft.AspNet.SignalR.Redis also has a dependency on StackExchange.Redis.StrongName

You can only have a dependency on one (either signed or unsigned) in a single assembly, but if you have multiple projects, you might have dependencies on both. It may simplify things to keep only the signed version to avoid problems

Solution 3

The strong name version is for developers who use strongly named assemblies in sharepoint and com+ development. The nuget package dev himself says that there is no simple answer for this question. Read the blog post here http://blog.marcgravell.com/2014/06/snk-we-need-to-talk.html

Share:
11,851
Mohamed Farrag
Author by

Mohamed Farrag

I have a great experience - since 2008 - in software field , specially .Net Web Development. I've worked with ASP.NET, MVC3/4/5 , Entityframework, SQL, MongoDB, Linq, HTML5, Razor, JQuery, Telerik controls. I got a very good experience with Azure cloud services , Appveyor for CI . JIRA , Trello for project management. SCRUM , Kanban for Agile methods. Worked with SVN, Mercurial , Git as source controls In java Spring , OSGI , HQL , MVC Model, JSTL , JSP, freemarker , Eclipse, Maven, Maven 2, Maven 3 , Apache Tomcat 6.0, 7.0, SVN , GIT, Lucene , Solr 1.4, PostgreSQL 8.4, PgadminIII , Manage projects by SCRUM I am Microsoft certified (MCTS .Net 2.0) with Diploma in IS and currently preparing master in IS. Also I worked with famous CMS like Nopcommerce and did a lot of great customization.

Updated on June 18, 2022

Comments

  • Mohamed Farrag
    Mohamed Farrag almost 2 years

    While I was following Azure documentation for how to use Redis Cache in Azure Portal I noticed this note:

    If you prefer to use a strong-named version of the StackExchange.Redis client library, choose StackExchange.Redis.StrongName; otherwise choose StackExchange.Redis.

    What is the strong-named ? and what is the proc and cons ? How to decide if I need it or not in my application ?

  • Dhanuka777
    Dhanuka777 over 8 years
    I find this answer covers a much more practical scenario than the real strong name usage.
  • radu-matei
    radu-matei over 8 years
    Also, Microsoft.AspNet.SignalR.Redis has a dependency on the strong named Redis library. But a rather strange behavior appears: Even if i have StackExchange.Redis installed, I have to install the strong named library and uninstall it in order for my SignalR server to work. Is there anything more in the package? And why does it work after uninstalling? (I can't keep both StackExchange.Redis and StackExchange.Redis.StrongName since there are conflicts)?
  • EdmundYeung99
    EdmundYeung99 over 8 years
    @Matei_Radu because both assemblies provide the exact same classes so you can't reference both in the same assembly (and have it work)
  • radu-matei
    radu-matei over 8 years
    Yes, I am aware that they contain the same classes, but does the strong-named version contain anything more (except the signing stuff) ?
  • EdmundYeung99
    EdmundYeung99 over 8 years
    @Matei_Radu no, it is the exact same source, except signed. Microsoft.AspNet.SignalR.Redis has a dependency on the StrongName version thus you need the StrongName dependency for SignalR to work
  • radu-matei
    radu-matei over 8 years
    Yeah, I thought that since StackExchange.Redis has the same types and is the same source, I might get away with using it:) Thanks, I solved it.
  • Aidanapword
    Aidanapword over 7 years
    Thanks for great contribution to the discussion. Just to be clear, the use of strong names is not specific ONLY to SharePoint and COM+ development.
  • Stevie W
    Stevie W over 4 years
    It looks like the Strongname version of the library is no longer getting updates - the regular version has been updated to v2, while the strong name is still at v1.2.6. Likewise, the RedisSessionStateProvider has also beenn updated (as of v4) to have the regular StackExchange.Redis v2 as a dependancy. This thread still comes up in google, so worth an update even though the thread is old.
  • Krzysztof Madej
    Krzysztof Madej over 3 years
    The new version of Microsoft.Web.RedisSessionStateProvider doesn't rely on StackExchange.Redis.StrongName