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

3

7

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?

Voluntaryism answered 17/10, 2011 at 6:35 Comment(2)
Great question. Unfortunately I'm pretty sure the answer is that it isn't supported/no way to do it...Minard
Why didn't you just declare everything Internal from the start?Agonize
P
3

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.

Phillisphilly answered 17/10, 2011 at 6:37 Comment(0)
H
1

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.

Haversine answered 17/10, 2011 at 6:37 Comment(0)
G
0

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/

Ginni answered 30/4, 2012 at 15:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.