是否需要对Visual Studio Extensions(VSIX)进行强命名? [英] Do Visual Studio Extensions (VSIX) need to be strong named?

查看:105
本文介绍了是否需要对Visual Studio Extensions(VSIX)进行强命名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2012 SDK中的默认VSPackage模板会生成一个使用强命名的项目.

The default VSPackage template in the Visual Studio 2012 SDK generates a project which uses strong naming.

因为强命名是可传递的,所以这意味着我添加的所有引用(例如,同一解决方案中的另一个项目或第三方依赖项)也必须使用强命名.

Because strong naming is transitive, this means that any references I add (e.g. another project in the same solution, or a third-party dependency) also need to be strong named.

由于我不太喜欢使用强命名的第三方依赖关系,因此我希望从VSIX中删除强命名.

Since I don't feel comfortable strong-naming third-party dependencies, I'd prefer to remove the strong naming from my VSIX.

这样做的缺点是什么?

推荐答案

如果您已经可以VSIX部署并且在GAC中不需要任何东西,那么否,Visual Studio不需要您使用强名称签名.我相信模板向导确实需要强名称签名,但这仅是因为必须将它们安装到GAC中.

If you are already VSIX-deployable and don't need anything in the GAC, then no, Visual Studio makes no requirement that you are strong name signed. I believe template wizards do require strong name signing, but only because they must be installed into the GAC.

无论如何,我可能会想到一些原因:如果您的程序包公开了其他扩展使用的公共API,则您可能会引用其他人使用您的公共API的公共DLL.您可能要对公共接口二进制文件进行强名称签名,并且取决于项目的设置方式,您可能必须对所有内容进行强名称签名.

I can think of a few reasons you might want to anyways: If your package exposes a public API which other extensions consume, you might be referencing a common DLL as the other people consuming your public API. You might want to strong-name sign the public interface binary, and depending upon how your projects are set up, you might have to strong name sign everything.

此外,如果您没有使用强记号,那么您确实有可能与另一个扩展名发生名称冲突.如果您创建了一个名为"Package.dll"的DLL,并且也进行了另一个扩展,而您的强名都没有对您的二进制文件进行签名,则CLR在这里可能会有些混乱.因此,如果您不是强名签名,请确保您的程序集名称足够唯一"以避免这种风险.

Also, if you didn't strong name sign, you do risk a name collision with another extension. If you created a DLL called "Package.dll" and another extension also did, and neither of you strong name signed your binaries, it's possible the CLR will get a bit confused here. So if you weren't strong name signing, make sure your assembly name is "unique enough" to avoid this risk.

对于它的价值,当我们在内部测试Roslyn语言服务时,我们只需通过安装包含所有Roslyn位的VSIX来这样做.快速浏览源代码控制历史记录意味着在第一年半的时间里,我们没有对软件包的二进制文件进行强名称签名,直到最终不得不从Microsoft交付代码的过程中获得了

For what it's worth, when we test the Roslyn language services internally, we simply do so by installing a VSIX that contains all of the Roslyn bits. A quick dig through source control history implies we didn't strong-name sign our package binaries for the first year and a half, until we eventually had to as part of the process of shipping code from Microsoft.

这篇关于是否需要对Visual Studio Extensions(VSIX)进行强命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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