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
0 comments:
Post a Comment