Loading ...

Friend assembly reference is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations. | CodeAsp.Net

Friend assembly reference is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.

 /5
0 (0votes)

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!

Comments (no comments yet)

Top Posts