Assembly has a strong name, but I"m getting the error that says a strong name is needed

The assembly you are trying to load does not have a strong name. This can be seen by your message, it says PublicKeyToken=null. If it had a strong name, it would have a public key token.

If you have given it a strong name after you compiled or referenced it, try to reference it again in your project. Maybe your project has still the old reference and is trying to load an unsigned version.


I have seen the behavior before when working with the Mongo CSharp Driver. From Version 1.10.0 and up they stopped providing strongly named assemblies, so you had to sign them yourself.

When I signed the 3 dll's provided; MongoDB.Bson, MongoDB.Driver, and MongoDB.Driver.Core, I neglected the built in dependency structure of those assemblies. MongoDB.Driver was dependent on MongoDB.Driver.Core which was dependent on MongoDB.Bson. This meant although my code was referencing the signed assemblies the pre-compiled assemblies were referencing the signed assemblies they were dependent on.

In general you'll observe this behaviour when you have a dependency tree such as this

Assembly1 -------> Assembly2
   |                   |
   |---> Assembly3 <---|

Where both assemblies 1 & 2 are dependent on assembly 3 but assembly 1 is also dependent on assembly 2. Its one step short of a circular dependency which makes it very rare.

I discuss the process and SDK tools available for signing a 3rd party DLL and resolving this issue in part 4 of the 5 part series. .NetFU also had a good article on the process but their page has since been removed.