I'm having a lot of trouble trying to sign a F# class library project. First I've tried this thread, using the AssemblyKeyFileAttribute but had no success. I also tried to add the flag "--keyfile:keyfile.snk" to the project properties ("Other Flags" field in "Build" tab) and It did't worked too. I'm using Visual Studio 2013, and It does not shows the "Signing" tab like C# class library projects.
All the attempts results in the following error:
FSC: error FS2014: A problem occurred writing the binary 'obj\Release\ExcelFinancialFunctions.dll': A call to StrongNameGetPublicKey failed (Value does not fall within the expected range.)
What am I doing wrong?
FWIW, here's how I sign ZeroToNine: Instead of using Visual Studio, I do it as part of the build script. Essentially, it's done by using AssemblyOriginatorKeyFile
and SignAssembly
:
MSBuild.exe /property:AssemblyOriginatorKeyFile=mykey.snk /property:SignAssembly=true
You can see (almost) all the nitty-gritty details in the ZeroToNine repo, including the actual build script I use for signing. The only detail missing from the public repo is the actual .snk file, because it would make no sense to have a strong name key if it was publicly available.
Here's how I call the build script from Bash:
build-release.sh ../ZeroToNine.snk
As you can see, I have my .snk file residing outside of the repo, and pass it in as an argument to the script.