4

I would like MSBuild to fail on the specific warning MSB3274 (which is what you get when a reference cannot be resolved because it was built against a higher version than the currently targeted framework).

I tried

MSBuild.exe .\test.csproj /p:Configuration=Release /p:Platform=AnyCPU /p:WarningsAsErrors=MSB3274

but the warning is still treated as a warning, and the build succeeds.

How can I get an error from MSBuild if the build produces this specific warning?

About the "question already has answer" note: the answer to the question "MSBuild: Treat single warning as error" does not work in this case, as I stated in the example where I'm already using the WarningsAsErrors property.

Community
  • 1
  • 1
Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193
  • 1
    Same idea, different warning: http://stackoverflow.com/q/17495278/128384 – stijn Apr 08 '16 at 10:07
  • @stijn: interesting solution, thansk. How strange that there's no msbuild command line parameter though. – Paolo Tedesco Apr 08 '16 at 10:37
  • 1
    @HansPassant: TreatWarningsAsErrors should treat *all* warnings as errors, here I just wanted a specific one. However, if I specify it, the build succeeds anyway. – Paolo Tedesco Apr 08 '16 at 10:51

0 Answers0