3

I have recently taken over support for an application for a developer who has left our company that use the standard template provided for all of our developers.

When I try to build the application, I get the following error:

Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Here is the source code that is causing the error:

MasterPage mark up

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

Code behind:

public partial class AppStatic : System.Web.UI.MasterPage

I have Googled this error message and the solution to to verify the Inherits matches that CodeFile class name.

5
  • 1
    You might want to ascertain the namespace
    – codingbiz
    Aug 7, 2012 at 0:14
  • The MasterPage does not have a namespace. Aug 7, 2012 at 0:27
  • Did you ever get this figured out?
    – Ann L.
    Oct 4, 2012 at 15:36
  • An extremely belated point, more for anyone else who might come across this as I assume Michael has long since solved this and moved on - check that there is not another class named "AppStatic" elsewhere in the solution. This may not be the cause of this specific problem, but I can imagine the symptoms would match.
    – pwdst
    Mar 31, 2013 at 17:35
  • My problem was that my markup inherited "System.Web.UI.MasterPage" instead of the codebehind class "MasterPage" Oct 6, 2015 at 17:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.