Accessing an internal class from an external assembly

I was working with a customer’s code base recently and I noticed a separate Unit test project was referencing an internal class in a different assembly. Initially, I expected a code smell and perhaps some kind of wrapper that was exposing an internal class some how. After doing a bit of digging and examining dependencies further with Resharper I drew a blank. How was this possible?


The Solution

I then recalled there’s a way of specifying a referenced dll as trusted but couldn’t recall how to do this. A quick Google (and good old Stackoverflow) pointed me towards marking the referencing assembly as a “friend” via the AssemblyInfo.cs .

The full detail over at Stackoverflow

Leave a Reply