The InternalsVisibleToAttribute allows an assembly to make its members marked with the internal visibility modifier visible to other assemblies. I’m not going to discuss whether this is good or bad, as every thing in life its not black or white, its rather gray :).
When the project assemblies are not strongly signed then it is just putting the assembly name without the version, culture and public key token, typically in the “assemblyinfo.cs” file.
[assembly: InternalsVisiblieTo(“MyCompany.MyAssemblyName”)]
When the project assemblies are strongly sign then the first step is getting the public key of the assembly that is going to see the internals. To do this we use the SN command.
sn –Tp <assembly file name>
This will print out the huge public key of the assembly. The it is just adding it to the attribute:
[assembly: InternalsVisibleTo(“MyCompany.MyAssemblyName, PublicKey= 02f…f0c68e6c7”)]
(I shorted the key because it is a huge string).