I recently added a Code Behind File to the layout.Master in my skin folder.
You cannnot do that. It already has a code behind that is compiled into mojoPortal.Web.dll, trying to do that will just break it.
You should not try to modify the code for layout.master nor put any new custom code directly in there.
You can embed custom UserControls in layout.master and the custom code can go in the user controls.
Hope that helps,
Joe