有没有一种简单的方法在VS 2010中签一个C ++ CLI的组件? [英] Is there an easy way to sign a C++ CLI assembly in VS 2010?

查看:343
本文介绍了有没有一种简单的方法在VS 2010中签一个C ++ CLI的组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我设置链接器/高级/ KeyFile中选择。

Right now I am setting the Linker/Advanced/KeyFile option.

我收到的mt.exe:一般警告810100b3:是一种强名称签名的程序集和嵌入清单的签名失效,您将需要重新签署该文件,使之成为有效的程序集。 的。

从网上阅读,这听起来像我必须设置延迟签名选项,下载SDK,并运行SN.EXE作为后生成事件。当然,必须有一个更简单的方法来做到这一点共同的操作VS2010?

Reading from the web, it sounds like I have to set the delay signing option, download the SDK, and run sn.exe as a post build event. Surely there must be an easier way to do this common operation in VS2010?

推荐答案

有跛行了相当数量的在这里,这只是从来没有工作过。它被认为是在VS2010的固定,mt.exe现在产生一个警告而不是让这个默默出问题。不是一个真正的解决,而且没有一个明显的例子,链接器不能只是嵌入的签名,仍然允许mt.exe事后运行。

There's a fair amount of lameness here, this just never worked before. It got "fixed" in VS2010, mt.exe now generates a warning instead of letting this silently go wrong. Not a real fix, and there's not an obvious one, the linker can't just embed the signature and still allow mt.exe to run afterwards.

解决的办法是重新签署了后期生成事件的组件。使它看起来是这样的:

The solution is to re-sign the assembly with a post-build event. Make it look like this:

命令= SN -Ra$(TARGETPATH​​)   $(项目名).SNK

Command = sn -Ra "$(TargetPath)" $(ProjectName).snk

如果您还没有密钥文件,你需要创建.snk文件自己,从Visual Studio命令提示符下运行SN.EXE。例如:

If you don't already have the key file, you'll need to create the .snk file yourself, run sn.exe from the Visual Studio Command prompt. for example:

cd \whereTheProjectIsLocated
sn.exe -k MyProject.snk

或从容器中提取或使用您指定的密钥文件。延迟签名是正确的命令行选项运行SN.EXE只是早晚的问题。

Or extract it from a container or use your designated key file. Delay signing is just a matter of running sn.exe with the proper command line options.

这篇关于有没有一种简单的方法在VS 2010中签一个C ++ CLI的组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆