I am migrating an ASP.NET MVC 5 application to ASP.NET Core 7.0.
After migration, I get now a compiler error with the following code:
@Html.Label("My Label", new { @class = "mt-4 mb-2" })
I am using a lot of @Html.Label in my code, it seems that there is a new parameter introduced for this helper in .NET Core:
IHtmlContent Label(string expression, string labelText, object htmlAttributes);
Seems there is no overload anymore which accepts only two parameters like in ASP.NET MVC 5 (labelText + htmlAttributes).
I suppose I have to update all of them with an "expression" parameter, or is there another solution?



I will always recommend using Label Tag Helper. You can use that like the following.
That is easiest part of doing that.