Is there a way to get the build command line used by Visual Studio?
Asked Answered
R

4

81

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?

Reindeer answered 6/11, 2013 at 20:53 Comment(4)
Doesn't it show up in the Output window?Decare
The build output does, warnings, errors, etc., but not the full command line used. Unless I'm missing something...Reindeer
It does but only with the right configuration. See this question: #9016611Decare
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!Reindeer
D
72

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

Decare answered 7/11, 2013 at 22:38 Comment(3)
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?Kosygin
@Dominique, The show all is not there, but the two options on the right are there.Nissy
This answer is invalid for Visual Studio 2017 or higher @Kosygin is correct. These suggestions don't work.Gyniatrics
E
20

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

Eden answered 17/9, 2019 at 6:22 Comment(0)
U
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

Urceolate answered 2/8, 2022 at 12:54 Comment(1)
Unfortunately that doesn't show all the options used, such as <AdditionalOptions>...</AdditionalOptions> that may be specified in .props files within the solution, whereas the technique above of getting detailed MSBuild information will include such optionsSublunary
T
0

I think the option you are looking for is the "Suppress Banner". If you switch that option off or disable it, uncheck that option, it will show all the options used at compile time. I found the option but i do not remember where it is located in the menu tree.

Tibetoburman answered 10/6, 2024 at 12:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.