How can i stop a Tag Helper automatically being used?
You can add a !
before the tag name to prevent the tag helper from executing:
<!form method="post">
<button type="submit">Submit</button>
</!form>
Source
You can remove a specific TagHelper from impacting a view by referencing its full type name, i.e.:
@removeTagHelper The.Full.TypeName.Of.The.TagHelper, TheAssemblyNameTheTagHelperExistsIn
Alternatively if you want to disable all TagHelpers in an assembly:
@removeTagHelper *, TheAssemblyNameTheTagHelperExistsIn
So to come full circle, if you want to disable all default MVC TagHelpers you can include the two lines:
@* This nukes ~/ resolution and ITagHelperComponents (things running on body/head), this is an auto-inclusion in every view *@
@removeTagHelper *, Microsoft.AspNetCore.Mvc.Razor
@* These TagHelpers are typically included via a _ViewImports.cshtml. This nukes all of the MVC TagHelpers (environment, input with asp-for, etc.)*@
@removeTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers