Aug 13, 2007 12:50 PM|devThis|LINK
We just had a similar problem.
One of our developers wanted a master page that was just like the original site master, but he removed some items from the aspx page, but pointed the code behind file to be that of masterpage1, instead of having a separate codebase to keep up with. The
problem arised when a control was added to masterpage1, and was referenced in the code behind, the compiler stated that the item was not referenced, but didn't tell us that it was masterpage2 that was the problem.
So the fix here is to add the same control to both masterpages, or get mastepage1 to do what masterpage2 does, and delete masterpage2.
Changing the build option to none will work until you hit a page that references masterpage2.