IDE says MasterPage not found, but builds/runs fine
I am stumped as to why my pages are saying the MasterPage cannot be found,
even though the MasterPages are where they are specified. For example:
In default.aspx
<%@ Page Title="Welcome" Language="C#" MasterPageFile="~/Master.Master"
AutoEventWireup="true" CodeBehind="default.aspx.cs"
Inherits="My_site.default" %>
In the above line, "~/Master.Master" is underlined in green. Hovering with
my mouse shows a balloon that reads File '~/Master.Master' was not found.
Master.Master definitely exists in the root folder of my site. The site
builds fine and all of my pages DO find ~/Master.Master when ran on either
my local PC or when uploaded to my hosting account.
The biggest annoyance is that I can't view my pages in the VS IDE because
it says The Master Page file '~/Master.Master' cannot be loaded. Correct
the problem in Code view. I see nothing to fix...
I have completely deleted the /obj/Debug and /obj/Development folders,
clicked to Clean the entire solution, and done a complete build. Every
page that uses a Master Page on my site is telling me this.
After running into some problems with long filename errors (unrelated
issue) I moved my solution/project to a folder off of my C:. I named the
solution folder C:\My_Site and inside of it there is a project folder
called My_Site. The full path to my project files is C:\My_site\My_Site.
If I change MasterPageFile="~/Master.Master" to
MasterPageFile="~/My_Site/My_Site/Master.Master" then the IDE stops
reporting an error and will allow me to view pages in design mode without
a problem - although the site will not build this way. The compiler
reports problems that the Master Pages cannot be found.
I read a post here on SO - Error: "The file
'/MasterPages/MainMaster.master' does not exist." (Yes, this file does
exist!) but my files are not located in a virtual folder. I use IIS
Express and so am pretty limited with configuring it. I am uneasy about
right-clicking my project and converting it to anything. I'm not sure what
the effect of that would be.
Anyone have an idea what's possibly happening and how I might resolve this?
No comments:
Post a Comment