[英]VS 2019 - ASP.NET Core MVC web app (written in C#) : multiple errors on brand new project
Brand new project utilizing ASP.NET Core 5.0 MVC, and written in C#.使用 ASP.NET Core 5.0 MVC 的全新项目,编写于 C#。
I'm getting multiple errors inside the Error List window when viewing any of the default.cshtml pages.查看任何 default.cshtml 页面时,错误列表 window 中出现多个错误。
However, the project still builds and runs normally.但是,该项目仍然可以正常构建和运行。
Errors include:错误包括:
- The name 'ViewData' does not exist in the current context.
- The name 'RenderBody' does not exist in the current context.
- The name 'await' does not exist in the current context.
- The name 'Context' does not exist in the current context.
- The namespace "ASP" already contains a definition for '_Page_Default_cshtml'
(For full list https://pastebin.com/YM5JnqBj ) (完整列表https://pastebin.com/YM5JnqBj )
It may be because you did not choose ASP.NET and .NET Cross-Platform Development when installing VS 2019. Only other environments were selected for development.可能是你安装VS 2019时没有选择ASP.NET和.NET跨平台开发,只选择了其他环境进行开发。 I created my ASP.NET project without installing the correct modules.我在没有安装正确模块的情况下创建了 ASP.NET 项目。 After noticing this, I went back and installed the two missing modules, but this did not solve the problem.注意到这一点后,我回去安装了缺少的两个模块,但这并没有解决问题。 Some links on the back end of VS 2019 are not established. VS 2019后端有些链接没有建立。
The final solution-reinstall VS 2019 with the correct modules from the beginning (without trying to fix it first).最终的解决方案——从一开始就用正确的模块重新安装 VS 2019(不要先尝试修复它)。 Now all assistants, the code is complete, Intellicode, everything is normal.现在所有助手,代码完整,Intellicode,一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.