Unmanaged C++ - need strong name to be referenced by C++/CLI dll with strong name?

可紊 提交于 2019-12-04 15:41:23

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.

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!