Search code examples
c#.netstylecopcsproj

How to set compilation option in many projects


I have many projects/solution in my company. I want to simple them configuration.

How can I assure every project to have checked "Treat warnings as errors", it is possible? Or force all project to use one styleCop file.


Solution

  • You can manually change all project to Import some shared set of settings (usually named with ".target" extension) to set <TreatWarningsAsErrors>true</TreatWarningsAsErrors> for all projects. If doing so check if setting on project level does not override import one.

    Sample from article:

    </Project>
      ....
      <Import Project="$(CommonLocation)\General.targets" />
    </Project>