【问题标题】:InternalsVisibleTo causes CS0246 error: The Type or Namespace could not be foundInternalsVisibleTo 导致 CS0246 错误:找不到类型或命名空间
【发布时间】:2010-11-19 03:21:50
【问题描述】:

我正在尝试通过添加使一个程序集能够访问另一个程序集的内部类

[assembly:InternalsVisibleTo("assembly-name")]

到第二个大会。但是,这会导致以下错误:

error CS0246: The type or namespace name 'InternalsVisibleTo' could not be found (are you missing a using directive or an assembly reference?)

我正在关注这里的示例: MSDN Reference

我做错了什么?

【问题讨论】:

    标签: c# assemblies internal internalsvisibleto


    【解决方案1】:

    确保导入 System.Runtime.CompilerServices。或者使用完全限定的名称。

    [assembly:System.Runtime.CompilerServices.InternalsVisibleTo("assembly-name")]
    

    【讨论】:

    • 做到了。感谢您的快速(准确)回复!
    猜你喜欢
    • 2019-07-14
    • 2019-09-14
    • 2013-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多