Andy @ Work

Wednesday, November 23, 2005

Problems with InternalsVisibleToAttribute?

Have you ever had this error when using the InternalsVisibleToAttribute?

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

BUT the assembly which contains the attribute isn’t being strongly signed?

More than likely you are dealing with some code that was ported from Visual Studio 2003. If you look at your AssemblyInfo file you will likely see the following attributes:


[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]


If you remove these three attributes your code will once again compile. It appears that if the compiler see any of these three attributes it thinks that the assembly must be strongly signed.

Had me scratching my head for quite some time.

1 Comments:

Post a Comment

<< Home