Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
InternalsVisibleToAttribute Class

Note: This class is new in the .NET Framework version 2.0.

Specifies that all nonpublic types in an assembly are visible to another assembly. This class cannot be inherited.

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)

Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple:=True, Inherited:=False)> _
Public NotInheritable Class InternalsVisibleToAttribute
    Inherits Attribute
Visual Basic (Usage)
Dim instance As InternalsVisibleToAttribute
C#
[AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)] 
public sealed class InternalsVisibleToAttribute : Attribute
C++
[AttributeUsageAttribute(AttributeTargets::Assembly, AllowMultiple=true, Inherited=false)] 
public ref class InternalsVisibleToAttribute sealed : public Attribute
J#
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false) */ 
public final class InternalsVisibleToAttribute extends Attribute
JScript
AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false) 
public final class InternalsVisibleToAttribute extends Attribute
NoteNote

In the .NET Framework version 2.0, Visual Basic does not support the use of this attribute.

Apply this attribute at the assembly level to specify that all nonpublic types in that assembly are visible to another assembly. For more information, see Friend Assemblies (C# Programming Guide) or Friend Assemblies. To apply this attribute to a strong-named assembly, you must know the hexadecimal string that represents the public key of the friend assembly.

The following code example makes nonpublic types in the declaring assembly visible to AssemblyB, to all versions of AssemblyB, and to all variants of AssemblyB that might contain different cultures.

[assembly:InternalsVisibleToAttribute("AssemblyB, PublicKey=32ab4ba45e0a69a1")]
System.Object
   System.Attribute
    System.Runtime.CompilerServices.InternalsVisibleToAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
InternalsVisibleToAttribute doesn't work with Visual Basic assemblies      Jawwad Alam ... Noelle Mallory - MSFT   |   Edit   |   Show History
According to Tim Ng, InternalsVisibleToAttribute doesn't work with Visual Basic 2005. Please see the link for more details: http://blogs.msdn.com/timng/archive/2006/12/14/friend-assemblies-for-visual-basic-orcas.aspx
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker