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?

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

Add a Comment

Your email address will not be published. Required fields are marked *