Why am I getting a parser error "Could not load type" in Visual Studio 2008

Issue

When creating a new web form with Visual Studio 2008 you are getting a parser error that states Could not load type... with the type name of your code-behind page.

This can be caused by the fact that Visual Studio 2008 does not, by default, copy references into the web form application’s References folder (whereas in Visual Studio 2005 it does) when building your project. Therefore, the compiler cannot load the WorkflowGen.My.Web.UI.WebForms.WorkflowPage type since it is not part of the local project on the WorkflowGen server.

Note: This only applies to web applications and not websites created in Visual Studio 2005 and Visual Studio 2008.

To fix this, you must set the Copy Local property to true in Visual Studio 2008