Home > Software design >  .NET Web App The type or namespace name 'AddTeacherPage' could not be found Error
.NET Web App The type or namespace name 'AddTeacherPage' could not be found Error

Time:07-28

Good luck with.

I'm getting these errors in the console:

Severity    Code    Description Project File    Line    Suppression State
Error   CS0246  The type or namespace name 'AddTeacherPage' could not be found (are you missing a using directive or an assembly reference?)    StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_TeacherManage_AddTeacher_cshtml.g.cs   123 Active
Error   CS0246  The type or namespace name 'AddTeacherPage' could not be found (are you missing a using directive or an assembly reference?)    StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_TeacherManage_AddTeacher_cshtml.g.cs   126 Active
Error   CS0246  The type or namespace name 'AddTeacherPage' could not be found (are you missing a using directive or an assembly reference?)    StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_TeacherManage_AddTeacher_cshtml.g.cs   125 Active
Error   CS0246  The type or namespace name 'AddStudentPage' could not be found (are you missing a using directive or an assembly reference?)    StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_StudentManage_AddStudent_cshtml.g.cs   113 Active
Error   CS0246  The type or namespace name 'AddStudentPage' could not be found (are you missing a using directive or an assembly reference?)    StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_StudentManage_AddStudent_cshtml.g.cs   112 Active
Error   CS0246  The type or namespace name 'AddStudentPage' could not be found (are you missing a using directive or an assembly reference?)    StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_StudentManage_AddStudent_cshtml.g.cs   110 Active
Error   CS0246  The type or namespace name 'AddClassPage' could not be found (are you missing a using directive or an assembly reference?)  StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_ClassManage_AddClass_cshtml.g.cs   109 Active
Error   CS0246  The type or namespace name 'AddClassPage' could not be found (are you missing a using directive or an assembly reference?)  StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_ClassManage_AddClass_cshtml.g.cs   108 Active
Error   CS0246  The type or namespace name 'AddClassPage' could not be found (are you missing a using directive or an assembly reference?)  StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_ClassManage_AddClass_cshtml.g.cs   106 Active
Error   CS0246  The type or namespace name 'ManageClassPage' could not be found (are you missing a using directive or an assembly reference?)   StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_ClassManage_ManageClass_cshtml.g.cs    62  Active
Error   CS0246  The type or namespace name 'ManageStudentPage' could not be found (are you missing a using directive or an assembly reference?) StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_StudentManage_ManageStudent_cshtml.g.cs    62  Active
Error   CS0246  The type or namespace name 'ManageTeacherPage' could not be found (are you missing a using directive or an assembly reference?) StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_TeacherManage_ManageTeacher_cshtml.g.cs    62  Active
Error   CS0246  The type or namespace name 'ManageClassPage' could not be found (are you missing a using directive or an assembly reference?)   StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_ClassManage_ManageClass_cshtml.g.cs    61  Active
Error   CS0246  The type or namespace name 'ManageStudentPage' could not be found (are you missing a using directive or an assembly reference?) StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_StudentManage_ManageStudent_cshtml.g.cs    61  Active
Error   CS0246  The type or namespace name 'ManageTeacherPage' could not be found (are you missing a using directive or an assembly reference?) StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_TeacherManage_ManageTeacher_cshtml.g.cs    61  Active
Error   CS0246  The type or namespace name 'ManageClassPage' could not be found (are you missing a using directive or an assembly reference?)   StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_ClassManage_ManageClass_cshtml.g.cs    59  Active
Error   CS0246  The type or namespace name 'ManageStudentPage' could not be found (are you missing a using directive or an assembly reference?) StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_StudentManage_ManageStudent_cshtml.g.cs    59  Active
Error   CS0246  The type or namespace name 'ManageTeacherPage' could not be found (are you missing a using directive or an assembly reference?) StudentAndClassWebApp   C:\Users\emiry\source\repos\StudentAndClassWebApp\StudentAndClassWebApp\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_TeacherManage_ManageTeacher_cshtml.g.cs    59  Active

For some reason, it started giving an error while I was going to debug it out of the blue.

Since the error is the same in all of them, I put the codes of one page:

@page
@model AddTeacherPage
@{
    ViewData["Title"] = "Home page";
}

<div >
    <h2 >Add Teacher</h2>
</div>
<p>Welcome the teacher management page.</p>
<form>
  <div >
    <label for="teacherIdInput">Teacher ID (number only):</label>
    <input type="number"  min="0" id="TeacherId" placeholder="Teacher ID">
  </div>
  <div >
    <label for="teacherNameInput">Teacher Name:</label>
    <input type="text"  id="TeacherNameID" placeholder="Teacher Name">
  </div>
  <select >
    <label for="teacherClassSelect">Teacher Class</label>
    <option>Test</option>
  </select>
</form>

How can I solve the problem? Thanks in advance for your help.

CodePudding user response:

Click on AddTeacherPage on the 2nd line. Press Ctrl . to get quick actions. There should be an option to add a using statement to your page which defines the namespace containing your model class.

  • Related