posted 11/10/2011 by Vivek Thakur
I was compiling one of my friend's project and noticed this error:
Friend assembly reference is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
This error came up because one of the projects in my solution had a friend assembly reference to the other, and I needed strong signed assemblies for this project. To fix this error:
1. Get the PublicKey token from your key file using these commands:
(a) c:\>sn.exe -p key.snk key.pub (b) c:\>sn.exe -t key.pub : this will display a hexadecimal key token. Save that so that you can use it in the next step.
2. Copy this in the assemblyinfo.cs file of your primary project which references the friend assembly as follows:
[assembly: InternalsVisibleTo("My.Assembly, PublicKey=7df720a1c4851830")]
That's it, the solution should compile now!
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18