Is there a way to reference a library without a strong name? When I add a reference to the assembly in references and rebuild solution everything is fine, but when I call the class from this assembly solution it doesn't build.
Output says that referenced assembly should have strong name. What is the best solution? Strong naming library is not preferable.
The solution was to install StrongNamer from NuGet, which automatically adds a strong name to all referenced assemblies. Just simply having it referenced in the project fixed my issue.
You should strong name your open-source . NET libraries. Strong naming an assembly ensures the most people can use it, and strict assembly loading only affects . NET Framework.
To determine if an assembly is strong-typed, use the Strong Name Tool from Microsoft (http://msdn.microsoft.com/en-us/library/k5b5tt23(v=vs.71).aspx) by running the 'sn.exe -v <assembly>' command. You may need to download one of the Windows SDK packages to get access to this tool.
"Strong Name : Indicates that the reference has been signed with a key pair." If your current project's assembly is signed, then all your reference assemblies must also be signed. Failure to do so will result in this error.
I think the problem you have here is that the assembly you are trying to add the reference from is being signed with a strong name but the assembly you are trying to reference is not signed. A strong-named assembly can only reference other strong-named assemblies.
Either sign the assembly you are referencing or don't sign the assembly that is referencing it.
The reason why the error only appears when you actually call the class is because the compiler will strip out the reference in the compiled output if there is no code actually invoking the referenced assembly.
If it's the case that you really can't either add a strong name to the one being referenced, or remove the strong name from the one doing the referencing (sorry long-winded) then you are going to have to look at binding the class at runtime via reflection and then accessing it via a common base or interface - not ideal at all; or even worse actually invoking it via reflection, or dynamic
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With