如何检查程序集上的 InternalsVisibleTo 属性? [英] How can I check for an InternalsVisibleTo attribute on an assembly?

查看:24
本文介绍了如何检查程序集上的 InternalsVisibleTo 属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 ILMerge 合并了一个二级程序集,该程序集本身与 Castle.DynamicProxy 合并,并将大多数(如果不是全部)通常公共的 Castle 类型设置为内部.当我使用依赖于 Castle 类型的辅助程序集中的代码时,我收到一个 TypeLoadException,表明访问被拒绝.

I've used ILMerge to merge a secondary assembly that is itself merged with Castle.DynamicProxy, having set most if not all of the normally-public Castle types to internal. When I use the code from the secondary assembly that is dependent on the Castle types, I get a TypeLoadException saying that access is denied.

要检查的第一步是我的合并程序集是否仍然为 DynamicProxy2 程序集设置了 InternalsVisibleTo 属性.有什么办法可以检查这个吗?

The first step to check is that my merged assembly has the InternalsVisibleTo attribute still set for the DynamicProxy2 assembly. Any way to check this?

推荐答案

DotPeek 双倍显示- 单击程序集.[assembly: InternalsVisibleTo(...)] 应该可见零次或多次.

DotPeek shows this by double-clicking the assembly. [assembly: InternalsVisibleTo(...)] should be visible zero or more times.

此外,Ildasm 应该可以通过双击程序集的 MANIFEST 告诉您这一点.黄色弹出窗口显示以 .custom instance void [mscorlib]System.Runtime.CompilerServices.InternalsVisibleToAttribute 开头的行.

Also, Ildasm should be able to tell you this by double-clicking the MANIFEST of the assembly. A yellow popup shows lines that start with .custom instance void [mscorlib]System.Runtime.CompilerServices.InternalsVisibleToAttribute.

这篇关于如何检查程序集上的 InternalsVisibleTo 属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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