Reputation: 185
I was working on creating sample app using ASP.NET Core using Visual studio 2015 update 3. I didn't see "add view" or "go to view" option when I right clicked on the action method. Is there any settings I need to change in visual studio?
Upvotes: 3
Views: 1710
Reputation: 21
Try to Delete that controller and then add View and also check Name of controller folder is correct
Upvotes: 0
Reputation: 7812
You need to understand the difference between ASP.NET MVC and ASP.NET Core.
In the first one, you had two different types of controllers:
System.Web.Mvc.Controller
)System.Web.Http.ApiController
)So when you clicked on "Go to view" from that method
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
Visual Studio was smart enough to understand that the view /Home/Index.cshtml
was the good one to navigate to.
With ASP.NET Core you don't have such difference anymore, all controllers inherit from Microsoft.AspNetCore.Mvc.Controller
no matter the controller returns a view or some raw data. And they can both return an IActionResult
whatever the return type.
I believe Visual Studio could improve a bit and detects there is a line return View();
in your method, but ASP.NET Core is new and there are tons of more important features with higher priority to implement for the moment...
Upvotes: 4