Advertisements

Archive

Posts Tagged ‘Build Failed’

StyleCop warnings failing the build in Visual Studio

Recently we got a VS project from a third party and when we try to build the project, we were getting StyleCop warnings as errors and breaking the build.

In below screen if you notice, even if all were ‘StyleCop’ warnings (i.e., Starts with SA….) build got failed with errors.

StyleCop violations as Build Errors

Reason:

  • By default, StyleCop violations only appear as warnings however StyleCop violations can be configured to fail the build by adding below tag in your project file (i.e., .csproj)

<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>

  • Coming to our reason of build failure was above line added in my Project file.

Fix:

  • Open the project file (i.e., .csproj) in notepad and remove the <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings> tag.
  • Save the file
  • Open the Project in Visual studio and Clean & Rebuild.

🙂

 

Advertisements