祝你好运。
我在控制台上看到了这些错误:
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出于某种原因,在我突然调试它时,它开始出现错误。
由于它们中的错误都是相同的,所以我将代码放在一页:
@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>我怎样才能解决这个问题?提前谢谢你的帮助。
发布于 2022-07-28 12:51:31
点击第二行的AddTeacherPage。按Ctrl+.采取快速行动。应该有一个选项向页面添加一个using语句,该语句定义包含模型类的命名空间。
https://stackoverflow.com/questions/73153176
复制相似问题