Showing posts with label snk. Show all posts
Showing posts with label snk. Show all posts

Saturday, March 24, 2012

Strong name signature could not be verified

Hi,

I've downloaded a set of C++ files written by someone else (a wrapper for the ImageMagick object called MagickNet), created an snk file using sn -k and figured out how to add this reference to the assembly (I'm not a C++ programmer, but I figured out to use assembly:AssemblyKeyFileAttribute in AssemblyInfo.cpp). The result seems to compile fine.

However, when I add a reference to the dll in VS2005 and try to compile my project there, I get:

Error 4 Could not load file or assembly 'MagickNet' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

I get something similar trying to use gacyutil to add the dll to the GAC.

Does anyone know what on earth is going on here? I've googled this and it looks like a pretty rare error message, certainly no-one else out there seems able to shed any light on it.

Can anyone assist?

Cheers,

Matt

Sorted it eventually, thought I'd post here with the solution in case anyone else came across the problem.

The issue turns out to be with the way you assign the key file to the build in C++. In older versions of Visual Studio the solution I adopted (adding a line to AssemblyInfo.cpp) was apparently the correct one but it's not correct in Visual Studio 2005, although it won't give you an error if you build with it. Instead you need to go to project properties, then linker, then advanced and edit the entry for key file in there. This will build a correctly signed assembly.

This is really poorly documented. Astonishingly, I only found the answer on a generic page about file building focused on C# and VB ... there's nothing about this I can see in the equivalent C++ pages!

http://msdn2.microsoft.com/en-us/library/6f05ezxy(VS.80).aspx

Cheers,

Matt

Strong naming assembly in an vb aspx project

I put my StrongNameKey.snk in my root foler.
in my assemblyinfo.vb I have:
<Assembly: AssemblyKeyFileAttribute("StrongNameKey.snk")>
I get the error "Error creating assembly manifest: Error reading key
file 'StrongNameKey.snk' -- The system cannot find the file
specified."
?
/MHi,
The placement of key depends on what mode are you compiling your vb project
with i.e. Debug or Release.
This is a VB issue cause the build directory for VB.NET assemblies is not
the same as the output directory, which usually is \bin (relative to the
project). If the solution configuration is in the default Debug mode, the
output directory is \obj\Debug. If in Release mode, it's \obj\Release. This
is where the strong
name key file must be placed.
HTH,
Piyush
<job@.bla.com> wrote in message
news:2hkd12t1gb8ic7v3tsmrc2eehdou99okpq@.
4ax.com...
> I put my StrongNameKey.snk in my root foler.
> in my assemblyinfo.vb I have:
> <Assembly: AssemblyKeyFileAttribute("StrongNameKey.snk")>
> I get the error "Error creating assembly manifest: Error reading key
> file 'StrongNameKey.snk' -- The system cannot find the file
> specified."
> ?
> /M
Hmm. my project is a web project and I only have a bin output folder.
Even in my unittest class project in the same solution, I have the
same error. Strange.
On Tue, 14 Mar 2006 10:07:02 -0500, "Piyush Daiya"
<pdaiya@.primeassociates.com> wrote:

>Hi,
>The placement of key depends on what mode are you compiling your vb project
>with i.e. Debug or Release.
>This is a VB issue cause the build directory for VB.NET assemblies is not
>the same as the output directory, which usually is \bin (relative to the
>project). If the solution configuration is in the default Debug mode, the
>output directory is \obj\Debug. If in Release mode, it's \obj\Release. Thi
s
>is where the strong
>name key file must be placed.
>HTH,
>Piyush
><job@.bla.com> wrote in message
> news:2hkd12t1gb8ic7v3tsmrc2eehdou99okpq@.
4ax.com...
>

Strong naming assembly in an vb aspx project

I put my StrongNameKey.snk in my root foler.

in my assemblyinfo.vb I have:
<Assembly: AssemblyKeyFileAttribute("StrongNameKey.snk")
I get the error "Error creating assembly manifest: Error reading key
file 'StrongNameKey.snk' -- The system cannot find the file
specified."

?

/MHi,

The placement of key depends on what mode are you compiling your vb project
with i.e. Debug or Release.
This is a VB issue cause the build directory for VB.NET assemblies is not
the same as the output directory, which usually is \bin (relative to the
project). If the solution configuration is in the default Debug mode, the
output directory is \obj\Debug. If in Release mode, it's \obj\Release. This
is where the strong
name key file must be placed.

HTH,

Piyush
<job@.bla.com> wrote in message
news:2hkd12t1gb8ic7v3tsmrc2eehdou99okpq@.4ax.com...
> I put my StrongNameKey.snk in my root foler.
> in my assemblyinfo.vb I have:
> <Assembly: AssemblyKeyFileAttribute("StrongNameKey.snk")>
> I get the error "Error creating assembly manifest: Error reading key
> file 'StrongNameKey.snk' -- The system cannot find the file
> specified."
> ?
> /M
Hmm. my project is a web project and I only have a bin output folder.
Even in my unittest class project in the same solution, I have the
same error. Strange.

On Tue, 14 Mar 2006 10:07:02 -0500, "Piyush Daiya"
<pdaiya@.primeassociates.com> wrote:

>Hi,
>The placement of key depends on what mode are you compiling your vb project
>with i.e. Debug or Release.
>This is a VB issue cause the build directory for VB.NET assemblies is not
>the same as the output directory, which usually is \bin (relative to the
>project). If the solution configuration is in the default Debug mode, the
>output directory is \obj\Debug. If in Release mode, it's \obj\Release. This
>is where the strong
>name key file must be placed.
>HTH,
>Piyush
><job@.bla.com> wrote in message
>news:2hkd12t1gb8ic7v3tsmrc2eehdou99okpq@.4ax.com...
>> I put my StrongNameKey.snk in my root foler.
>>
>> in my assemblyinfo.vb I have:
>> <Assembly: AssemblyKeyFileAttribute("StrongNameKey.snk")>
>>
>> I get the error "Error creating assembly manifest: Error reading key
>> file 'StrongNameKey.snk' -- The system cannot find the file
>> specified."
>>
>> ?
>>
>> /M