Kris Krause .NET Meister

"If it is fast and ugly, they will use it and curse you; if it is slow, they will not use it."
- David Cheriton, The Art of Computer Systems Performance Analysis

Wednesday, July 23, 2008

VB.NET InternalsVisibleTo

Unfortunately, the InternalsVisibleTo attribute does not work with the .NET 2.0 Framework for VB.NET. However, I just installed Visual Web Developer 2008 Express SP1 Beta and it works! Thanks Microsoft for making my NUnit testing a little easier (and cleaner).

To reproduce:

Create a VB.NET class library named ClassLibrary1. Add a single class with only a friend constructor. Add the following attribute to AssemblyInfo.vb:

Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ClassLibrary2")

Add another VB.NET class library named ClassLibrary2. Add a project reference to ClassLibrary1. Verify that you are able to construct an instance of the above class.

Labels: ,

0 Comments:

Post a Comment

<< Home