Feel like a geek and get yourself Ema Personal Wiki for Android and Windows

06 July 2009

InternalsVisibleTo attribute how-to

I tried avoiding the InternalsVisibleTo attribute for our testsprojects, simply because I didn't know how it works or how I could get it to work.

But that is not a very convincing reason not to use it. So for future reference:

1. Sign the test project with your keyfile

2. navigate to the test assembly with a visual studio command prompt and get the output of this command:
sn.exe -Tp <assembly>


3. Attach the parts of the public key together to form one long string of characters, and create an attribute in the target assembly:
InternalsVisibleTo("Assembly.Name.Here, PublicKey=00240000048.....")

No comments: