在VS2013中签署C ++ / CLI程序集 [英] Signing C++/CLI assemblies in VS2013

查看:121
本文介绍了在VS2013中签署C ++ / CLI程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆C ++ / CLI项目,需要强名称/签名,以便将它们推送到GAC。



I做了以下,我使用VS2013。



1.使用SN.exe实用程序生成* .snk文件。

2。在C ++ / CLI项目的属性设置中,我已将Linker->高级页面中的Key文件属性设置为步骤1中生成的snk文件。

3.创建一个post build事件到使用命令行Sn -Ra [Assemblyname] [Snkfilename]对程序集进行签名。



完成上述三个步骤后,我构建了项目。我尝试使用Gacutil将最近构建的DLL推送到GAC,只是为了看到错误[AssemblyName]不代表强命名的程序集。我相信DLL没有正确签名。



如果我在这里缺少任何一步,请告诉我。

另外,我读了关于使用AssemblyInfo.cpp文件,没有明确它们的用法。任何有关此事的帮助表示赞赏。



谢谢,

DD

解决方案

< blockquote>要签名,请使用项目属性页,最后一个名为签名的选项卡。选中签署 a ssembly,然后使用选择一个强名称 k ey文件选择< Browse ...>项目清单。从文件对话框中选择文件并完成签名。



有很多方法可以检查是否有一些程序集已签名。一种简单的方法是:在其他项目中通过其模块名称(使用添加引用窗口的浏览选项卡)引用此程序集。使用文本编辑器查看项目文件 - 它应该显示引用程序集的强名称。



-SA

I have a bunch of C++/CLI projects and the need is to Strong name/Sign them, so that they can be pushed to the GAC.

I have done the following, I use VS2013.

1. Generated the *.snk file using the SN.exe utility.
2. In the C++/CLI project's property setting, I have set the Key file attribute in the Linker->advanced page, to the snk file generated in step 1.
3. Created a post build event to sign the assembly using the command line Sn -Ra [Assemblyname] [Snkfilename].

After the three above steps, I built the project. I tried pushing the recently built DLL to GAC using Gacutil, only to see the error "[AssemblyName] doesn't represent a strongly named assembly". I believe the DLL was not signed properly.

Please let me know, if I am missing any step here.
Also, I read about using the AssemblyInfo.cpp file, have no clarity on their usage. Any help on the matter is appreciated.

Thanks,
DD

解决方案

To sign, use the project property page, last tab named "Signing". Check "Sign the assembly", then use "Chose a strong name key file" to choose "<Browse...>" list item. Select your file from file dialog and finalize the signing.

There are many ways to check up is some assembly is signed. One simple way is this: reference this assembly by its module name (using Browse tab of the "Add Reference" window) in some other project. Look at the project file using a text editor — it should show you a strong name of a referenced assembly.

—SA


这篇关于在VS2013中签署C ++ / CLI程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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