73

I want to do a build from the command line, but I'd like to get the exact command line syntax from Visual Studio (2012), so that I don't have to manually figure out all of the flags, imports, and other parameters.

Is there a way to get Visual Studio to display this information?

Joshua Frank
  • 13,120
  • 11
  • 46
  • 95
  • Doesn't it show up in the Output window? – acfrancis Nov 06 '13 at 20:54
  • 1
    The build output does, warnings, errors, etc., but not the full command line used. Unless I'm missing something... – Joshua Frank Nov 07 '13 at 00:25
  • 2
    It does but only with the right configuration. See this question: http://stackoverflow.com/questions/9016111/to-see-all-command-line-on-output-window-while-compiling – acfrancis Nov 07 '13 at 11:13
  • Ah, that worked! If you post that link as an answer (ideally pasting the relevant part of the answer), I'll accept it as the answer to this question. Thanks! – Joshua Frank Nov 07 '13 at 20:35

3 Answers3

69

When you build a project or solution in Visual Studio, the entire command line used to run the compiler (csc.exe, including switches and parameters) is displayed in the Output window. If you don't see it there, check the Verbosity level by going to:

Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity

(You may need to choose "Show all settings") options in toolbar -- finding projects and solution in options

It has to be set to "Normal" or higher. Check this question and answer for more details:

To see all command line on output window while compiling

Community
  • 1
  • 1
acfrancis
  • 3,569
  • 25
  • 21
  • 11
    Sorry, guys, but I'm working with Visual Studio 2017 and I don't see the "Show all settings" checkbox, and obviously I don't see the command, even while having "Detailed" or "Diagnostic" verbosity. Any ideas? – Dominique Jul 07 '17 at 07:54
  • 3
    @Dominique, The show all is not there, but the two options on the right are there. – MarcWeintraub Oct 31 '17 at 13:46
  • 1
    This answer is invalid for Visual Studio 2017 or higher @Dominique is correct. These suggestions don't work. – Krishnan Venkiteswaran Jan 30 '23 at 13:44
17

I don't have enough reputation to comment acfrancis's answer, so I just post this simple answer: In Visual Studio 2017, following acfrancis's answer, but set two option to Detailed: enter image description here and then copy the output, search cl.exe and link.exe(Well a lot of lines, In this case 730 lines, I can't fint both without search), you can find something like this: enter image description here enter image description here

0

The output window on verbose mode produces a lot of text. If you are interested in compilation and linking flags there is an easier way.

Just check your project configuration properties, C/C++ -> Command Line and Linker -> Command Line

enter image description here

Julek
  • 178
  • 6
  • Unfortunately that doesn't show all the options used, such as ... that may be specified in .props files within the solution, whereas the technique above of getting detailed MSBuild information will include such options – Tim Sep 20 '22 at 15:26