Can I make internals visible to all assemblies signed with same key?

1.4k views Asked by At

I have an assembly with functionality that I don't want exposed as public but still accessible to my other assemblies. This can be done using InternalsVisibleToAttribute by specifying each assembly that it will make its internals visible to.

I was wondering if there is a way that I didn't have to specify all the referencing assemblies but instead just enforce the rule that an assembly must be signed by the same snk to have the internals made visible.

Does this functionality exist and if so, could someone point me in the right direction?

3

There are 3 answers

0
Jon Skeet On BEST ANSWER

No, I don't believe anything like that is available automatically.

You could write your own tool to generate the [InternalsVisibleTo(...)] lines, and add unit tests to ensure that all such references have the same key though.

0
Muhammad Hasan Khan On

I'm not aware of anything that enforces this for you and automatically generates the InternalsVisibleTo but you could write a Visual Studio Extension that does that.

0
Vadim On

I hope that the utility I created few years ago can make your life a little bit easier to add InternalsVisibleTo to your AssemblyInfo.cs file.

Here's the link: http://vkreynin.wordpress.com/2007/12/09/testing-internals-members-with-internalsvisibleto-attribute/