Tuesday, January 10, 2006 - Posts

Visual Basic 2005 Does Not Support Friend Assemblies

I’ve gotten some feedback from Visual Basic .NET developers having trouble following my “How To” on code coverage and IL Merge. I turns out that the Visual Basic .NET 2005 compiler doesn’t support the InternalsVisibleTo attribute. After adding the attribute to an assembly, you won’t get any IntelliSense for the internal, or fiend in Visual Basic lingo, members. When you try to build the solution the compiler will raise a BC30390 compilation error akin to 'MyClass.Private Function MyMethod(x As Integer, y As Integer) As Integer' is not accessible in this context because it is 'Private'. Unfortunately, there is no workaround for this, so Visual Basic developers either have to spilt their projects into a handcrafted code project and a generated code project, and live with the housekeeping implications of having twice as many assemblies to deploy, or live with skewed code coverage results.