How do I fix the error: CS1548: Cryptographic failure while signing assembly ?
- by Paula DiTallo
The full error in Microsoft Visual Studio on a compile looks like this:
error CS1548: Cryptographic failure while signing assembly 'C:\Program Files\Microsoft SQL Server\100\Samples\Analysis Services\Programmability\AMO\AMOAdventureWorks\CS\StoredProcedures\obj\Debug\StoredProcedures.dll'
This is likely due to a missing strong key pair value file. The easiest way to solve this problem is to create a new one. Navigate to:
Microsoft Visual Studio 2010>Visual Studio Tools>Visual Studio x64 Win64 Command Prompt (2010) [if you aren't on an x64 box, pick another command prompt option that fits]
Once the MS-Dos window displays, type in this statement:
sn -k c:\SampleKey.snk
Then copy the output *.snk file to project directory, or the *referenced directory.
Remove the old reference to the *.snk file from the project.
Add the paired key back to the project as an existing item.
When you add back the *.snk file to the project, you will see that the *.snk file is no longer missing.
Our work is done!
*referenced directory: Pay attention to the original error message on compile. The *.snk file that is referenced may be in a directory path you aren't expecting--so you will still get the error unless you change the directory path or write the file to the directory the program is expecting to find the *.snk file.