简体   繁体   English

VS 2019 - ASP.NET Core MVC web 应用程序(用 C# 编写):全新项目出现多个错误

[英]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,一切正常。

ERROR:错误: 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在新的VS Studio 2017 ASP.NET MVC 5.2.3项目中使用C#7功能时编译错误 - Compile errors when using C# 7 features in new VS Studio 2017 ASP.NET MVC 5.2.3 project 在ASP.NET MVC核心应用程序中更新引用的.NET 4.5.2项目时出现编译错误 - Compilation errors when updating a referenced .net 4.5.2 project in asp.net mvc core app 全新ASP.NET Core 2.1项目的构建时间缓慢 - Slow Build Time on Brand New ASP.NET Core 2.1 Project 全新的MVC Asp.Net项目会加载默认页面,但之后会显示403。 - Brand new MVC Asp.Net Project Loads default page, but 403 after for anything else 我没有找到 ASP.NET 核心 Web 应用程序(新项目与代码) - I didn't found ASP.NET Core Web Application (New project vs code) ASP.NET Core 2.1,C#应用程序,C#Web服务,访问SQL数据库 - asp.net core 2.1, C# app, c# web service, access SQL database 使用 VS Code 在 ASP.NET Core MVC 中调试 javascript 和 c# - Debug both javascript and c# in ASP.NET Core MVC using VS Code 在ASP.NET MVC Core项目中使用View内部的C#7功能 - Using C# 7 features inside of a View in an ASP.NET MVC Core project Asp.NET 核心 web 应用程序在创建新项目时不显示 - Asp.NET Core web application not showing on creation of new project 如何在 ASP.NET 核心 MVC 中安装使用 C# Winforms 制作的现有 web 服务 - How to install an existing web service made with C# Winforms in ASP.NET Core MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM