TL;DR Just grab the .snk from the Roslyn repo, name your bridge assembly to something from the InternalsVisibleTo (e.g. Roslyn.Hosting.Diagnostics), sign it with the key, and you can access all the internals at compile time, with IntelliSense!
When I started out the ‘Pad, I naturally turned to Reflection to access those types. Even Roslyn’s @jaredpar agrees:
In C++ every problem can be solved with a template
In .NET every problem can be solved with private reflection
There are things you can’t do even with private Reflection. While you can access existing types, you can’t inherit from an internal class or implement an internal interface. Fortunately, Roslyn’s assemblies have an InternalsVisibleTo to DynamicProxyGenAssembly2, so I used Castle to generate implementations for what I needed. This was cumbersome, but it worked.
However I recently came to realize there’s a far better way: Roslyn’s has a lot of InternalsVisibleTo its test assemblies, and the .snk with the private key is in the public repo. So I just created a bridge assembly, named it to one of the test assemblies, signed it with the .snk, and now I can access all the internal types as if they were public. Super!