Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top