Thursday, July 03, 2008

MasterPage.master.cs does not exist error

I got the very weird error with ASP.NET 2.0 deployment. It has been running well in my development machine. Then, I published my test WebApplication project from visual studio to make release the compiled dll so that the application can be run on server without deploying .cs source code files. But after published it, the system gave the error “MasterPage.master.cs does not exist”.

It was very weird and it tempted to me considering whether it’s because “.cs” files are also required to deploy. But if that’s was the case, what’s the point of publishing?

After a while, then I finally realised that MasterPage I created doesn’t have namespace.

After I added namespace in masterpage.master.cs file and published it again. Then, It was fine.

In ASP.NET 2.0, it seems like

- WebApplication project requires to have namespace for every class in the project if you deploy the system by publishing (.dll and aspx only).

- WebSite project, it seems doesn’t require to have namespace even though if you deploy it by publishing.

Server Error in '/WebAppTest' Application.


Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The file '/WebAppTest/MasterPage.master.cs' does not exist.

Source Error:

Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

Line 2:


Source File: /LEGATOTest3/WebAppTest.master Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434