Command-line arguments for MSBuild used by Visual Studio 2010?

Answered Command-line arguments for MSBuild used by Visual Studio 2010?

  • Monday, January 11, 2010 11:14 AM
     
     
    Hello

    When I build a solution from within Visual Studio I see 16 warnings but when I build it with msbuild from a command prompt I only get to see 10 warnings. Furthermore, everytime I try to run msbuild.exe directly on the solution with the rebuild targets I get an error.

    Therefore my question is if there is a way to see what command line arguments Visual Studio uses for msbuild?

    Cheers

    Gabriel

All Replies

  • Tuesday, January 12, 2010 5:03 AM
     
     Answered
    Hi Gabriel,

    Thanks for your post.
    You could check Project Settings -> Build -> Conditional compilation symbols to see if there are something specified.
    The only reason I can think out is: maybe the source files which generate the missing warnings are skipped dependant on some conditions or just are "up-to-date" when compiling from MSBuild, could you please double check with it?
    And could you please tell us what are the missing warnings with MSBuild from command prompt? or provide a sample project so we can reproduce it from our side.

    Sincerely,
    Wesley

    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Monday, January 18, 2010 3:24 AM
     
     

    Hello,

    How are you? Is your problem resolved? May I know whether the above suggestions helped you?

    Thanks,
    Wesley


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, January 20, 2010 7:40 AM
     
     Answered

    The MSBuild command line arguments can be reviewed by typing:

       msbuild /?

    or they are documented here: http://msdn.microsoft.com/en-us/library/ms164311.aspx

    If you are trying to determine a build issue, from the command line, use the /v switch to specify the verbosity. (m=minimal, n=normal, d=detailed, and diag=diagnostic). Note that diagnostic is really verbose (although it also gives the calls and time spent for each part of the process, which can be very interesting). So, for exmaple, you can specify detailed verbosity like this:

       msbuild myproject.vcxproj /v:d

    You can use the /fl switch to create an msbuild.log file in the directory containing the output. This is sometimes easier to read, but, then you miss that wonderful color coded logging we provide. :) You can use it like this:

       msbuild myproject.vcxproj /v:d /fl

    The log file will be created in the local directory.

    For diagnosing hard to find targets issues, using the /pp (v4.0 only) switch will allow you to expand all of the imports and dump the full MSBuild file. To use it type:

       msbuild myproject.vcxproj /pp

    Note that if you are refering to warnings placed in the Warning tab of the Error List (versus the Output Window, which basically shows you what you would see when you build from the command line), this tab can contain non-build related errors. For example, XML documents that have invalid structure and are open will place warnings in this tab. Simply closing the XML file (or HTML or other similar SGML document) will make these go away.

    In the IDE, you really want to compare the output in the Output Window with what you see on the command line. These should be the same. If not, oh snap, we probably made a boo boo. :) But, these are very rare.

    To make sure you are comparing Apples and Apples, you can set the verbosity of the Output Window like you can using the command line switch above. To do this, click "Tools", then "Select Options...". In the Options dialog, select "Project and Solutions" node from the tree on the left. Expand that node and select the "Build and Run" item underneath. The page varies slightly from version to version, but there is a drop down near the bottom that is labeled something like "MSBuild Project Build Output Verbosity". The drop down gives you the same selection as the command line option switch I gave above, but have nice pretty long names. ;)

    Note in Visual Studio 2010, there are two similar drop-downs. One is for the Output Window, and one is for the written log that is saved to disk. So, make sure you select the correct one.

    Hope this helps...

    Chuck England
    Visual Studio Platform
    Program Manager - MSBuild

    • Marked As Answer by Wesley Yao Thursday, January 21, 2010 6:22 AM
    •  
  • Friday, April 15, 2011 2:55 AM
     
     

    Chuck,
    How do i retrieve the warnings placed in the Warning tab of the Error List through MSBuild and get it to log to a SQL database?

    These are warnings related to obsolete methods, missing xml comments, unused variables etc.

    Thanks,
    Shubham

  • Friday, January 27, 2012 3:27 PM
     
     

    I cant see that this answers the orignal question, aside from the warnings issue the questions is asking

        "Therefore my question is if there is a way to see what command line arguments Visual Studio uses for msbuild?"

    not

       What are the possible commandline options for msbuild.exe?

     

    So how does one determine the msbuild commandline visual studio spawns?

    Spurtus.

     

  • Sunday, March 18, 2012 11:16 AM
     
     

    Hi Spurtus,

    Have you figured out how to see the generated Visual Studio MSBuild script? I am looking for the same issue and haven't found a solution yet.

    Regards


    Ahmed Abuabdou, Senior SharePoint Developer, Bank AlBilad

  • Tuesday, March 20, 2012 4:48 PM
     
     

    I never got to the bottom of this and had to move on.

    Sorry about this.

    Spurtus.

  • Thursday, May 31, 2012 2:39 PM
     
     

    Any answer to this yet?

    I seem to remember that we used to be able to view the build command line in VC6.