1

I have a C# class library project which uses Postsharp, which is unable to build. I am getting the following error:

Exception in .NET strong name API invocation. Error while getting key info for '<my .snk file path>': Strong name key container not found. (Exception from HRESULT: 0x8013141C).

Furthermore the error specifies that the error occurs in a file by the name "POSTSHARP" in the directory in which the project resides, however this file does not seem to exist.

From the information which i have been able to gather, it seems that I am unable to sign my project due to an error with regards to the strong name key belonging to Postsharp, or something along those lines. This issue only occurs on my machine, and not anyone else working on the same project. Furthermore, my .snk file is used in other projects in the same solution which also use the same version of Postsharp and .NET Framework.

I am using Visual Studio 2019, Postsharp version 4.3.48, and .NET Framework 4.5.2.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
HansBakn
  • 11
  • 2

1 Answers1

1

PostSharp is trying to load the private key of your SNK. The key container can be coming to PostSharp through [AssemblyKeyName] attribute used in the assembly, KeyContainerName MSBuild property or env variable, or PrivateKeyContainer PostSharp property.

The error means that somehow PostSharp could not get the private key from the API. There may be several causes

See also this ticket:

Postsharp throws System.Runtime.InteropServices.COMException (0x8013141C): Strong name key container not found. (Exception from HRESULT: 0x8013141C)

Gael Fraiteur
  • 6,759
  • 2
  • 24
  • 31
  • Hi Gael, thanks for your reply. Do you have any suggestions what I should investigate to resolve my issue? – HansBakn Sep 23 '22 at 10:03
  • You should investigate that the key container exists and that the current user (or the user under which PostSharp is running) has access to it. – Gael Fraiteur Sep 23 '22 at 10:08