Search code examples
.netasp.net.net-2.0code-behind

ASP.NET 2.0 Compilation Error: Make sure that the class defined in this code file matches the 'inherits' attribute


Okay I'm completely stuck on this compilation error. It's a Web Site (not web app), .NET 2.0.

I have a file in this directory: welcome_teams

file name: default.aspx

Page Declaration:

<%@ Page Language="C#" MasterPageFile="~/masters/Site.master" 
AutoEventWireup="true"    CodeFile="default.aspx.cs" 
Inherits="welcome_teams_default" %>`

Code Behind

public partial class welcome_teams_default : System.Web.UI.Page

And I keep receiving this error: Make sure that the class defined in this code file matches the 'inherits' attribute

I've tried deleting the file, and adding it again as "new item" and no matter what, the error persists.

Any ideas?

Thanks!


Solution

  • So, it had nothing to do with namespaces, it has to do with the default2.aspx page, pointing to the default.aspx page.

    The default2.aspx page's CodeFile attribute was set to "default.aspx.cs" which screwed it all up.

    For anyone who might have this problem in the future though, you can sometimes solve it by changing CodeFile to CodeBehind.

    Also, in theory it was a namespace issue, but god do I hate how Website projects handle namespaces.