Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
public class HomeController : ControllerBase
{

public ViewResult Details()
{
return View(model);
}

}

What I have tried:

public class HomeController : Controller
{

public ViewResult Details()
{
return View(model);
}

}
Posted
Updated 3-Aug-20 23:24pm

1 solution

Have a look at the usings on top of the source code.
This error can occur if you do not have
using Microsoft.AspNetCore.Mvc;
there.
The compiler then is not able to resolve "View".
Also have a look at your solution.
You must have the Framework "Microsoft.AspNetCore.App" referenced.
Another issue could be that you did not derive HomeController from the Microsoft.AspNetCore.Mvc.Controller class. So verify if
ControllerBase
derives from it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900