Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 290
Luke Baulch Avatar asked Oct 17 '11 06:10

Luke Baulch


2 Answers

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.

like image 160
Jon Skeet Avatar answered Oct 11 '22 20:10

Jon Skeet


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.

like image 34
Muhammad Hasan Khan Avatar answered Oct 11 '22 20:10

Muhammad Hasan Khan