The type or namespace name ‘LayoutsPageBase’ does not exist in the namespace ‘Microsoft.SharePoint.WebControls’ (are you missing an assembly reference?)
by Dave Mellors • February 9, 2011 • SharePoint, Software Development • 0 Comments
After creating an empty SharePoint 2010 solution in Visual Studio 2010 I added an Application Page to the project but compiling failed and gave me the following error:
The type or namespace name ‘LayoutsPageBase’ does not exist in the namespace ‘Microsoft.SharePoint.WebControls’ (are you missing an assembly reference?)
Using the object browser in Visual Studio I could see that the namespace Microsoft.SharePoint.WebControls didn’t contain LayoutsPageBase (Image 1) but when I viewed the same Microsoft.SharePoint.dll outside of Visual Studio (in Red Gate Reflector) I could see (Image 2).
The reason for this was quite simple when I created the SharePoint Project I had chosen to deploy it as a Sandbox Solution and application pages are not supported in sandboxed solutions. Selecting the project properties and changing the Sandboxed Solution property to False and it compiled successfully.

