I inherited a website this week and it wouln't build. In the past the website was built in debug mode and the files were moved out manually. It wouldn't built in release mode and it wouldn't allow for me to do a publish website. It received the error ... "does not contain a definition for context."
The web page had the following page definition:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage1.aspx.cs" Inherits="MyPage1" %>
Whereas, the codebehind for MyPage1 (MyPage1.aspx.cs) included the wrong class name. I updated the class name to correspond to the class name mentioned in the web page and it will now build in release mode.
public partial class MyPage2 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)