libphonenumber-csharp: Unable to load PhoneNumbers.dll in signed assembly
When depending on PhoneNumbers.dll through NuGet in a project producing a strong name signed assembly this exception is thrown each time PhoneNumbers.dll would be used:
System.IO.FileLoadException: Could not load file or assembly 'PhoneNumbers, Version=8.8.10.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) File name: 'PhoneNumbers, Version=8.8.10.0, Culture=neutral, PublicKeyToken=null'
This can be fixed by strong name signing PhoneNumbers.dll see PR #51
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16 (8 by maintainers)
I don’t need strong name signing personally, but my 2c is it’s the right thing to do for libraries.
The msft documentation you linked says:
Strong name signing is not a security measure, it only provides a unique identity to an assembly.
The pros of strong name signing are:
.dllinto their project. Repeat when there is an update.The cons:
How to do it?
.snkusingsn.exeand check it in to the root of the repo.SignAssemblyandAssemblyOriginatorKeyFileto the csprojConclusion:
In regards to this snippet you copied:
Yes, this is true, anybody who is updating the nuget package (eg. from v1 to v2) will need to re-compile their app. But I hardly see this as a problem. Who in their right mind updates a NuGet package by dropping in a new dll, without recompiling their software?
Please note that the author of the second link had second thoughts later in 2018:
https://www.pedrolamas.com/2018/09/11/start-strong-naming-your-assemblies/
Just some feedback to the quoted comment:
Applying common sense, the strong name would and likely should be applied moving forward. This would NOT impact current assemblies from previous releases and thus would not impact anyone using them. Nobody in their right mind would delay sign an in use assembly, unless it is required.
In short, I am all for strong naming and it will be required moving forward in several of my own projects using this library.
Perhaps the author might provide two NuGet packages, one signed and the other not.
This has been brought up a few times. https://github.com/twcclegg/libphonenumber-csharp/issues/18, https://github.com/twcclegg/libphonenumber-csharp/issues/48 and that which it references https://github.com/octokit/octokit.net/issues/405 Given that it has come up a few times now I’m going to take another look at it and make sure it don’t cause issue for any existing users.
Hi @twcclegg - Any update on this? We need strongly named version. Thanks