I am having a problem in building my solution in VS2008. Normally, it compiles fine in the environment. Sometimes, it fails with:
/xxx_WEB/secure/CMSManagedT
I had similar issue, and got a close clue from @JBicford's answer. I was using Default.aspx on root of website using Master.master in another folder. Don't know if that can cause that, haven't tested this solution yet.
But for someone who is interested in getting publishing problem sort out, below option works for VS 2012, all other options fail because of incorrect dependencies on other folders and pages.