Question

I have a unmanaged C++ dll, which will be used by a managed C++/CLI wrapper .dll, which will eventually be used by a C# project.

C# project is strong-named, so is the wrapper .dll. I tried doing the same for the unmanaged dll, using /KEYFILE, but doesn't seem to work. And the wrapper is complaining:

.... is a strong-name signed assembly and embedding a manifest invalidates the signature

Do I need to strong-name the unmanaged C++ at all? If not, how do I resolve this issue?

Était-ce utile?

La solution

It is not possible to strong-name a native DLL. Most of all because doing so is meaningless, only the CLR will ever validate a strong name and only does so on .NET assemblies.

Just in case: a strong name is not a substitute for a code-signing certificate. Biggest hint this is so because you don't have to hand over a big wad of money to anyone.

Autres conseils

Finally got it all working, i.e. my C# app calls C++/CLI wrapper dll, which calls a class in native C++ dll!

To solve the problem:

mt.exe : general warning 810100b3: ... MyWrapper.dll is a strong-name signed assembly and embedding a manifest invalidates the signature. You will need to re-sign this file to make it a valid assembly.

IMPORTANT: It turns out the strong name in referenced class was not the issue.

It turns out there is something wrong with how VS sign the wrapper dll in this case. See link: http://blogs.msdn.com/b/vcblog/archive/2011/03/11/10140139.aspx

In short, to solve this, in your wrapper C++ class, add this as your Post Build command to re-sign:

sn.exe -R $(SolutionDir)$(Configuration)\MyWrapper.dll MyKeyFile.snk
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top