[Solved] Asp.Net 5 Error: error RZ2008: Attribute 'asp-for' on tag helper element 'label' requires a value

Question: How do you resolve Razor MVC Error in Asp.Net 5 FileName.cshtml (88,28) "error RZ2008: Attribute 'asp-for' on tag helper element 'label' requires a value"?

Answer: The error shows you the line number to go look for mistakes, in this case, it mentions that on FileName.cshtml on line 88, the Razor MVC Tag Helper called "asp-for" does not have a value.

Example: asp-for="". It should be "asp-for="SomeValueInHere"

- This error might not appear when developing, but when you attempt to build your project then you might see an error in the error-counts, but then the error itself might not appear in error logs. This is the problem with Visual Studio not showing Razor related errors in the error log.

[NB] In order to resolve this, try to run the application. Errors like this are shown on Run-Time or Compile Time.

[NB] In order to see the Razor MVC Error if Visual Studio does not show them, expand the Error List output Window and in the second from last drop-down menu, select "Build Only". Now you can see Error caught in Razor Pages.

Edit this Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

© 2022 - ErnesTech - Privacy