VS2019 - ViewBag does't exist in current context
问题 I have installed VS 2019 for Mac and started building an application. In my view, I get the following errors: The name ViewBag does not exist in the current context. The name Layout does not exist in the current context. What could be the cause for the issue and How could we resolve this? 回答1: You might be missing the ../Views/Web.config file, because you created the project from an empty ASP.NET application instead of using an ASP.NET MVC template. Or You need to add MVC-specific Razor