asp-controller and asp-action attributes not working

took me a while to figure it out -- but if you are like me still struggling with Cannot resolve symbol 'addTagHelper' after trying the accepted answer, you are probably running an ASP.NET MVC project instead of an ASP.NET Core project and therefore can not use the taghelper. Instead you have to use the htmlhelper

TLDR;

If this answer didn't work for you, please use the htmlhelper (*)

@using (Html.BeginForm("Trips", "App")) 
{
 ...
}

..instead of the taghelper (**)

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers


<form asp-controller="App" asp-action="Trips">
   ...
</form>

(*) applies to

ASP.NET MVC 5.2

(**) applies to

ASP.NET Core 2.1, 1.0, 1.1, 2.0, 2.2, 3.0, 3.1, 5.0


Adding @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers to the top of the cshtml file is worked.


When working with Areas I had to copy _ViewImport to the new Area\MyArea\Views


After a little bit of digging I found that asp-controller and asp-action attributes are called anchor tag helpers, and are part of the

Microsoft.AspNetCore.Mvc.TagHelpers namespace

Apparently it is an alternative to using Razor. I was able to resolve the issue by creating '_ViewImports.cshtml' and adding the below into the file:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

Once done that, anchor tag helpers were recognized and button start working as anticipated.