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

48.7k views Asked by At

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?

3

There are 3 answers

3
acfrancis On BEST ANSWER

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

1
Julek On

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

0
AudioBubble On

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