asp.net deploy - Main.Master.cs file not found

the file '/masterpage master cs does not exist
parser error message: the file does not exist
how to precompile asp.net web sites for deployment
how to publish asp net website using ftp
how to deploy asp net web application
how to deploy asp.net web application in iis

I am currently deploying my website on azure. One of my pages works ok, yet I have another page which uses a master page, which is not loading because I am getting this error:

Server Error in '/' 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 '/Main.master.cs' does not exist.

Source Error: 


Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="ThirdEye.Main" %>
Line 2:  
Line 3:  <%@ Register Src="~/controls/Footer.ascx" TagName="Footer" TagPrefix="ThirdEye" %>

Source File: /Main.master    Line: 1 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

I can't figure out what I have wrong. I have uploaded the executable, the pages are in the same directory of the bin folder. Do you think I have to add a period or tilde in front of CodeFile attribute or Inherits attribute?

I am using .net framework v4. I cant use 3.5 and I don't think that that should be the problem.

Main.Master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="Main" %>

Main.Master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using ThirdEye;

public partial class Main : System.Web.UI.MasterPage
    {....

Are you using a Web Application project (rather than a Web Site project)? If so, changing CodeFile to CodeBehind should resolve the error.

Web Application deployments are compiled, and do not include the original cs files that are required when you use CodeFile.

The file '/MasterPage.master' does not exist., However, when I deploy the site fully precompiled (non updatable) to a Windows Parser Error Message: The file '/MasterPage.master' does not exist. CodeFile​="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" 

Based on the error above, tt seems the MainMaster.master.cs is not deployed to Windows Azure.

When you add a new Master Page name "MainMaster.master" in your project, have you set its property to "Copy to Output Directory" as "Copy Always" because by default it is not set and due to this this file will not be part of your Windows Azure Package and cause such error.

Would u please verify if that is the case?

[Solved] Parser Error Message: The file '/Site.master' does not exist , Are the sites under IIS configured with the correct version of ASP.net?

To make sure the code files (*.cs) get included when you deploy to Azure, go to the Project Properties and under PACKAGE/Publish Web select "All files in this project folder" for the option Items to deploy (applies to all deployment methods)

Determining What Files Need to Be Deployed (C#), NET Files folder, which can be found at %WINDOWS%\Microsoft. NET pages' code portions (the WebPage.aspx.cs files). Building a project in Visual Studio does not create an assembly in the Bin A master page ( Site.master ). when viewing the ~/ Tech/CYOW.aspx page, the title is set to "Home 

The answer was that you should never name a page 'Main'! Very silly mistake!

Extreme ASP.NET: Codebehind and Compilation in ASP.NET 2.0 , Return to main site In fact, the change is so subtle that you may not even notice it unless Page Language="C#" AutoEventWireup="true" CodeFile="Default.​aspx.cs" In addition to turning your .aspx file into a class definition with to deploy binary codebehind assemblies along with intact .aspx files 

I've come across the same issues before. There are two solutions for this problem.

  1. As @Eric mentioned, in master file use CodeBehind instead of CodeFile.

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="ThirdEye.Main" %>
    
  2. Copy, the cs file to deployment; in this case copy 'Main.master.cs' inside "App_Master" folder in IIS. Normally, when you deploy the cs files doesn't get included.

Pro ASP.NET MVC 2 Framework, asp.net deploy - Main.Master.cs file not found. I am currently deploying my website on azure. One of my pages works ok, yet I have another page which uses a 

MasterPage.master.cs does not exist error, /Views This holds views (usually *.aspx files) and partial views (usually *.ascx files). By convention, views for the controller class XyzController are found inside /Views/Xyz/. /Global.asax /Web.config with a specific controller—for example, master pages (*.Master) and This is not your application's main Web.config file.

Creating ASP.NET Projects, After I added namespace in masterpage.master.cs file and published it the project if you deploy the system by publishing (.dll and aspx only).

Could not load type 'Pages_MasterPage' - asp.net - html, ASP.NET projects are similarly available for other languages, but may not be fully supported. Default.aspx, and grouped with it are its C# CodeBehind files Default.aspx.cs be deployed using the Project->Deploy to Web… command in the main menu, These are also found in Project Options, in the XSP Options panel.

Comments
  • i tried this but unfortunately this did not help me. I ended up with the same result. I'm very confused :(