How to Use InternalsVisibleTo
VS2005 defaults new classes to internal rather than public (although it appears that Orcas defaults to public). This is good as it reduces the public interface of your assembly and it encourages you to actually think about whether a class needs to be public.
You can allow other assemblies access to your internal types and members though, by using the InternalsVisibleTo attribute. This is especially useful for allowing your test assembly to access your internal classes.
This attribute can only be applied to strongly named assemblies.
[assembly:InternalsVisibleTo("TestAssembly, PublicKey=TestAssembly’s public key")]
The attribute requires the assembly name and the public key. To retrieve the public key use sn.exe. Open a visual studio command prompt and enter:
sn.exe -Tp AssemblyPath
Alternatively if you use an alternate file explorer you could set up a macro.