I’ve decided to use the InternalsVisibleTo assembly attribute to give access to some internal classes to a unit testing project.I added the attribute to my project, and I got this CS1726 compiler error. I duly googled for a solution, and discovered that (unsurprisingly) many people came across this error after strong naming their assembly.
The thing was that none of my assemblies were strong named. It turns out that the problem was due to the presence of the following attributes in my AssemblyInfo.cs file:
[assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")]
I commented them out and hey-presto, everything worked as expected. I think the presence if these attributes is a hang-over from VS2003. They don’t seem to be generated by default in VS2005 Assembly Info files.