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

查看:150
本文介绍了如何检查部件上的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.

要检查的第一步是,我的合并程序集的DynamicsProxy2程序集的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天全站免登陆