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
17 comments:
Hi,
I have the same problem as you have. My question is how can I add namespace with my existing masterpage.And also.I have other pages that doesnt have namespace, would it still work if I have a namespace in masterpage
In your code behind master page class, you can add namespace.
For e.g,
namespace MyNamespace
{
public class MyMasterPage : MasterPage
{
....
}
}
Then, you can change it again in master file.
For example,
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MyMasterPage.master.cs"
Inherits="MyNamespace.MyMasterPage" %>
Hope this helps.
Nice catch. That fixed my problem. Good lookin' out.
Also, if you have CodeFile instead of CodeBehind as the register directive in the Site.Master page, you will get the same error. Change to CodeBehind resolves the problem.
Thanks Forgotten Blogger. Changing CodeFile directive to CodeBehind fixed the error for me. - Arunabh Das
Found this post through google and it worked for me too. Thanks for sharing!
gracias a todos tengo el mismo problema y ya encontre la respuesta thanks
Perfect. Thanks for the post. Helped me resolve the same issue. Changing CodeFile to CodeBehind was the answer for me. Thanks.
Hi,
I have the same problem as you have. after deployment of asp.net web application on win Azure.
My question is how can i resolve the masterpage.cs not found error.
Please Help..
thanks in advance..
Wow, changing CodeFile to CodeBehind did it for me too.. You rock, thank you so much.
Wow, changing CodeFile to CodeBehind did it for me too.. You rock, thank you so much.
Neither adding a namespace OR changing the CodeFile to CodeBehind worked. Errors not comprehendable from compiling or deploying...
How does MS ship a system that is so broken???
Neither adding a namespace OR changing the CodeFile to CodeBehind worked. Errors not comprehendable from compiling or deploying...
How does MS ship a system that is so broken???
Thank you very much for this post! I have been searching for weeks now! I had a web application that was working for years that suddenly showed this behaviour... Keep up the good work!
Thanks HEAPS forgottenblogger, for your solution. That fixed my problem from CodeFile to CodeBehind.
An interesting discussion is worth comment. I think that you must write much more on this topic, it may well not be a taboo subject but typically folks are not sufficient to speak on such topics. To the next. Cheers
Online Panel Services MENA
Online Market Research Middle East
Online Surveys Middle East
Online Panel Saudi Arabia
Online Panel UAE
i have same problen it does not work for me then hoe can i salve it .....thanks in advance
Post a Comment