Friday, September 24, 2010

System.Web.MembershipProvider and RoleProvider references not found in unit tests after VS2010 upgrade

After updating a solution from VS2008 to VS2010 the unit tests for our custom web security providers started failing the builds with messages like:

Error    15    The type or namespace name 'MembershipProvider' could not be found (are you missing a using 
directive or an assembly reference?)    D:\Development\[snip].UnitTests\ProviderHelper.cs
Error    16    The type or namespace name 'RoleProvider' could not be found (are you missing a using 
directive or an assembly reference?)    D:\Development\[snip].UnitTests\ProviderHelper.cs
Error    4    The type name 'RoleProvider' could not be found. This type has been forwarded to assembly 
'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 
Consider adding a reference to that assembly.    D:\Development\[snip].UnitTests\ProviderHelper.cs

The last exception here reveals the issue. The project now needs a reference to System.Web.ApplicationServices