134

I need to get a hold of every flag, every switch used in the build process by the Visual Studio binaries. I tried to obtain a verbose output by using vcbuild, but I wasn't able.

What do I have to do to see everything performed by Visual Studio for me? It's not necessary to obtain the output in the build window. Anywhere would be fine.

Geo
  • 93,257
  • 117
  • 344
  • 520
  • 1
    Exact duplicate http://stackoverflow.com/questions/823854/how-to-show-command-line-build-options-in-visual-c-2008. – JesperE Jul 31 '09 at 16:07

5 Answers5

212

Menu ToolsOptionsProjects and SolutionsBuild and RunMSBuild project build output verbosity: Diagnostic

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
71

Visual Studio 2008:

Go to menu ToolsOptions then Project and SolutionsBuild and Run section. You have a combo box for verbosity.

C++ compiler option (project properties):

  • Preprocessor - Generate Preprocessed File for seeing the translation unit as generated by preprocessor
  • Advanced - Show includes - display included file names at compiler output
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Cătălin Pitiș
  • 14,123
  • 2
  • 39
  • 62
  • 1
    This does not show compile and linker flags, only file names that are being processed. Is it possible to see exact commands that are executed or this is impossible with VS? – stefanB May 20 '11 at 05:43
  • 2
    @stefanB: you don't need special flags for this. The command lines for the compiler and linker invocation can be found in the options dialog or in the build-log that is written into the intermediate directory. – Yakov Galka Jun 16 '11 at 18:35
71
  1. Open the project properties dialog, then choose

    Configuration PropertiesC/C++General

  2. Change the setting for Suppress Startup Banner to No

  3. The cl command line(s) will be shown in the output window.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tim Dowty
  • 1,460
  • 13
  • 9
  • 2
    This only affect compiler not linker or resources. – user2284570 Jul 27 '15 at 18:53
  • 7
    In VS2017 this 'trick' doesn't seem to work anymore. However building in the developer prompt using msbuild with the solution or project filename as cli argument does show the cl call with its arguments. – Emile Vrijdags Jul 10 '18 at 09:50
  • @EmileVrijdags I can perfectly see the `cl` command output with VS2017 following those steps. So the "trick" works for me. – nephewtom Jan 29 '19 at 21:28
  • Work in VS 2019, after I changed MSBuild verbosity it didn't show anything difference, but after I did this it works. – Khoa Vo Sep 12 '21 at 16:46
10

If you're running MSBuild, you can set the /v:diag flag.

Joe
  • 46,419
  • 33
  • 155
  • 245
  • start the visual studio command prompt (it's in the Start Menu), then execute the visual studio project with: MSBuild {ProjectName} – Joe Jul 31 '09 at 11:21
  • e.g. MsBuild myProject.csproj – Joe Jul 31 '09 at 11:22
  • I see MSBuild calls `vcbuild`, but vcbuild doesn't show the flags/switches it's using. – Geo Jul 31 '09 at 11:25
  • This is the proper answer I believe. Merely switching off the suppression various banners still doesn't output everything. In particular the resource compile step was what I was looking for. – John Nov 14 '14 at 20:11
5

In Visual Studio go to your project and right click on it and select properties. In Linker there is a command line option. There you have all the options and you can add your custom ones. Add /VERBOSE and when linking Visual Studio will show a lot more information.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
javier-sanz
  • 2,504
  • 23
  • 23
  • 1
    It does show more information, but it doesn't show the tools being called to compile. – Geo Jul 31 '09 at 11:21
  • 2
    Visual Studio has a make tool called nmake. You can export your project to those makefiles and and build it from a dos console http://msdn.microsoft.com/en-us/library/txcwa2xx(VS.80).aspx. Last time I did something similar (but I used CMake to generate the nmake makefiles) all the commands were printed out into the console display. – javier-sanz Jul 31 '09 at 11:44