Make internal classes visible to other assemblies

Neir0 picture Neir0 · Jan 16, 2013 · Viewed 34.1k times · Source

Is it possible to make internal classes from my assembly visible to other assemblies?

I know about the AssemblyInfo file and the [assembly: InternalsVisibleTo()] attribute, but it doesn't work in my case.

The main purpose is to make it possible to call methods from LINQPAD, so this [assembly: InternalsVisibleTo("LINQPad")] doesn't work. I don't know why. In my project, I'm using dependency resolver, and it is hard to do such a thing in LINQPAD. Any suggestions?

Answer

Joe Albahari picture Joe Albahari · Jan 17, 2013

I've just uploaded a new beta that allows this to work.

Add the following attribute to the libraries whose internals you want LINQPad to access:

[assembly: InternalsVisibleTo("LINQPadQuery")]

You'll also need to enable this feature in LINQPad's preferences (Edit | Preferences | Advanced).

Let me know how you get along.