Rob Kraft's Software Development Blog

Software Development Insights

Apply your Strong Name Key to both DLLs to resolve Friend access was granted compiler message in C#

Posted by robkraft on July 5, 2011

You will get a compiler error message like:

“Friend access was granted to ‘your dll, PublicKey=your key’, but the output assembly is named ‘your dll, Version=…, Culture=neutral, PublicKeyToken=null’. Try adding a reference to ‘your dll…’, or changing the output assembly name to match.”

when you are using Strong Named Keys (snk) files but you only have the .SNK file assigned to one of the two projects you are trying to compile. If you are using InternalsVisibleTo to expose Friend/Internal methods to another DLL, and either one of the DLLs has a strong named key, make sure they both have a strong named key. You can use the same strong name key on both DLLs.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: