0

I am building my VS solutions with DevEnv command line. However on build it shows lots of warning related to code analysis. Is there any way I can specify in command line not to run code analysis for Devenv?

Thanks

Ashwani K
  • 7,880
  • 19
  • 63
  • 102

1 Answers1

5

Building with Devenv has been deprecated since VS2010, you should be using MSBuild.exe instead.

Whether code analysis is performed is determined by the <RunCodeAnalysis> property in your project. You can override property values with the MSBuild /p command line option. For example:

   MSBuild yadayada.sln /p:runcodeanalysis=false

There certainly should not be any reason why you get code analysis warnings in a command line build but not in an IDE build. Your very short question provides no hints what the underlying reason might be. A very rough guess is that you are building the Release configuration with an inappropriate rule set.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Even though I'm with you on this in general there are valid reasons to use devenv.exe instead of MSBuild. We're facing the build-order-is-incorrect-using-msbuild-bug (http://blogs.msdn.com/b/visualstudio/archive/2010/12/21/incorrect-solution-build-ordering-when-using-msbuild-exe.aspx) on a customer's build servers and therefore have to use devenv.exe. I stumbled upon this issue because I want to override the RunCodeAnalysis setting for our CI build. – mkko Oct 15 '14 at 14:32
  • VS2010 were msbuild training-wheels, don't get stuck on an old version. – Hans Passant Oct 15 '14 at 14:36
  • Sure, if I were free to upgrade high-handed I'd do this first thing in the morning :) at the moment they are running Server 2003 build servers so I've got to live with it for the time being. – mkko Oct 15 '14 at 19:22
  • MSBuild doesn't work with extensions such as Visual Studio Installer Projects so unfortunately devenv has a large use case. – Shiv May 04 '17 at 06:49
  • "deprecated" maybe too strong a statement. As of VS 2019 it is still supported. The documentation does say "For build-related tasks, it's recommended that you use MSBuild instead of devenv. ", but `/Build`, `/Project`, `/Clean`, etc. switches still work fine. – tromgy Oct 21 '21 at 21:31