nicojs
nicojs

Reputation: 2055

Red build on invalid html razor with MvcBuildViews

Is it possible to get a red build whenever the html in a razor template is invalid? I thought it already worked that way... But I guess not.

<div>
  @Html.DisplayTextFor(model => model.FooterText) // this will be a build error 
</div>

<div class="banana> // this isn't a build error but i want it to be
</div>

Upvotes: 0

Views: 117

Answers (2)

Tetaxa
Tetaxa

Reputation: 4393

The default for visual studio is to report html validation errors as warnings. You can tell it to report them as errors under Tools -> Options then under Text Editor -> HTML -> Validation and uncheck "as warnings".

Upvotes: 1

K D
K D

Reputation: 5989

Surely the above wrong html will give you warning in VS. you can ask VS to make those as error.

have a look to this

Happy coding

Upvotes: 2

Related Questions