首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >类型或命名空间名称“.NET AddTeacherPage”找不到错误

类型或命名空间名称“.NET AddTeacherPage”找不到错误
EN

Stack Overflow用户
提问于 2022-07-28 12:45:37
回答 1查看 132关注 0票数 1

祝你好运。

我在控制台上看到了这些错误:

代码语言:javascript
复制
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

出于某种原因,在我突然调试它时,它开始出现错误。

由于它们中的错误都是相同的,所以我将代码放在一页:

代码语言:javascript
复制
@page
@model AddTeacherPage
@{
    ViewData["Title"] = "Home page";
}

<div class="p-3 mb-2 bg-dark text-white">
    <h2 class="display-4">Add Teacher</h2>
</div>
<p>Welcome the teacher management page.</p>
<form>
  <div class="form-group">
    <label for="teacherIdInput">Teacher ID (number only):</label>
    <input type="number" class="form-control" min="0" id="TeacherId" placeholder="Teacher ID">
  </div>
  <div class="form-group">
    <label for="teacherNameInput">Teacher Name:</label>
    <input type="text" class="form-control" id="TeacherNameID" placeholder="Teacher Name">
  </div>
  <select class="form-control">
    <label for="teacherClassSelect">Teacher Class</label>
    <option>Test</option>
  </select>
</form>

我怎样才能解决这个问题?提前谢谢你的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-28 12:51:31

点击第二行的AddTeacherPage。按Ctrl+.采取快速行动。应该有一个选项向页面添加一个using语句,该语句定义包含模型类的命名空间。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73153176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档