views:

682

answers:

4

I have a project that compiles and runs fine on my development machine but when I run it on the web server I get the following error.

Parser Error Message: The file '/Views/Shared/Main.master.cs' does not exist.

The file mentioned does not exist on the server but the file '/Views/Shared/Main.master' does.

I use the 'Publish' command to upload the project. Is it missing the cs files?

Is there some setting where it does just in-time compiling that need to turn off?

A: 

Usually the files are marked with a reference to a dll that exists in the bin, e.g. App_Web_nnnnn in the inherits declaration of Main.master. Is that the case for that file on the web server and does the referenced dll exist in the bin? If not then it may not be pre-compiling as it should.

Turnkey
+2  A: 

I stumbled upon this solution.

The master page has the following attribute CodeFile="Main.master.cs". When I replaced this with CodeBehind="Main.master.cs" it works as expected.

The file originally came from an older web application but I don't know what the difference means. If someone else can come up with a better explanation I will accept their answer instead of this one.

tpower
+1  A: 

Glad you got it figured out. It may come from an issue when converting from "Web Site" to "Web Application" project type.

http://aspadvice.com/blogs/ssmith/archive/2007/01/24/CodeFile-or-CodeBehind.aspx

Turnkey
A: 

As far as I have seen with MVC, I don't think you even need the code-behind pages, do you?

I have removed the references from any pages in my app that were there for any reason.

Also, when you create a new View, I don't think it even creates the code-behind page in MVC, does it? (Really threw me to start with!!)

Brett Rigby