MVC Tag Helpers Not Working

I have a problem with tag assistants. All I want to do is create a form that sends data to the controller - quite basic, I thought, but it does not work in my project.

I am creating a new asp.net base web application with a default setting and it works there, but my project refuses to recognize the tags and act accordingly. It is noteworthy that the markup does not highlight the same or does not provide information when it freezes, so some links or something fundamental is missing, can someone advise.

* The default project, working with the correct highlights enter image description here

* My project - without indicating the correct code or work. Project.json is the same, so I have no idea what is missing. enter image description here

+5
source share
1 answer

FOUND! Lord, mMicrosoft likes to change things. Thus, MVC 6 (asp.net core, etc.) can use the _ViewImports.cshtml file in the views folder (feel free to add it yourself if, like me, you created the project before it existed).

This acts like a GlobalImport file and allows you to use intermediary tags in all of your views to add ref here.

My now looks like this:

@using Mobile.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 

And the boom tags look right and its work is as expected. Thanks for the work of Microsoft!

+9
source

All Articles