Why I got the error: The tag helper 'body' must not have C# in the element's attribute declaration area

Viewed 1562

I've changed my pure usual body element in my _Layout.cshtml file from

<body data-my-attibute='myattributevalue'>

to

<body  @myAttributes>

and getting an error message:

Severity Code Description Project File Line Suppression State Error RZ1031 The tag helper 'body' must not have C# in the element's attribute declaration area.

The body element does not look and behave like a tag helper To be short: H E L P, this is a knife in my back Friday afternoon...

2 Answers

I had similar problem, i learned from documentation that you can disable a Tag Helper on a single tag by prepending !, so your code would be:

<!body  @myAttributes>
</!body>

well this is a shame but I am leaving here, there is a slight chance it helps someone...

@removeTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor
Related