PRB: Error Message: Cryptographic Failure While Signing Assembly (328379)
The information in this article applies to:
- Microsoft Visual C# .NET (2002)
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
This article was previously published under Q328379 SYMPTOMS
When you create an .snk file for an assembly, and you make the following changes to the AssemblyInfo.cs file:
[assembly: AssemblyKeyFile("snkFileName.snk")]
you save the file in the project directory of the assembly, and then you compile your project, you may receive an error message that is similar to the following:
"Cryptographic failure while signing assembly '...\WindowsApplication1.exe' --
'Error reading key file 'key.snk' -- The system cannot find the file specified."
CAUSE
The .snk file location of AssemblyKeyFile must be relative to the EXE directory or the DLL directory.
RESOLUTION
Before you compile the project, you must change the path to the .snk file.
To change the .snk file location by using the path from the debug or the release directory, open the AssemblyInfo.cs file, and then replace the AssemblyKeyFile code as follows:
[assembly: AssemblyKeyFile("..\\..\\SnkFileName.snk")]
STATUSThis behavior is by design.REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
306296 HOW TO: Create a Serviced .NET Component in Visual C# .NET
See the following chapter from the .NET Framework Developer's Guide on the Microsoft Developer Network (MSDN) Web site:
Modification Type: | Major | Last Reviewed: | 10/8/2002 |
---|
Keywords: | kbprb KB328379 |
---|
|