13

Is there a way to see what the CSC (or VBC) parameters are, when building an application using the Visual Studio?

Visual Studio calls CSC.exe/VBC.exe behind the scenes. I want to know if there is a way to see that call.

I need this info to replicate the equivalent Build script using the command line.

I set the different levels of verbosity for the build, still I do not see any CSC.EXE call in the output window.

I'm really surprised why Microsoft did not put an easy way to see the underlying CSC command.

AJ if I go through your steps I get: enter image description here

I do not see any reference to CSC


OK here is how I resolved this:

First I went to tools and options and set the verbosity to detail. (After this point still build output was empty).

Then I got Service pack for VS2010.

I also had similar issue for Visual Studio 2012 I had to get "update 4" to see the logs and CSC.EXE ion the output.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
S Nash
  • 2,363
  • 3
  • 34
  • 64
  • It doesn't, MSBuild.exe invokes the compiler. And does a whole lot more. Readily visible when you crank up the build verbosity. Running MSBuild.exe yourself is the only reasonable way to reproduce the build. – Hans Passant Aug 26 '14 at 14:02
  • Well, I'm not sure that gives any benefits in this case. As far as I know msbuild is also a DOS application. So to call it I need to provide the required parameters about the project. – S Nash Aug 26 '14 at 14:10
  • @SNash: You can use `msbuild` by giving it the project file and a *few* properties (e.g. `msbuild SomeApplication.csproj /p:Configuration=Release`). The problem with your approach of invoking `csc.exe` directly is that you are going to just ignore all the build information contained in your project file. (Quick, do you know how to sign an assembly? If your project is configured to produce a signed assembly, then MSBuild will also do that). `MSBuild` is *hands down* the most reasonable way to make a build on the command line. – Jean Hominal Aug 26 '14 at 14:59
  • Assuming I use msbuild. Then how I get " all the build information contained in my project file. " and pass it to msbuild. That is my question. – S Nash Aug 26 '14 at 15:45
  • There's some information on this thread: http://stackoverflow.com/questions/25338905/how-could-i-know-the-specific-command-visual-studio-use-to-compile-a-c-sharp-sol By the way, don't call MSBuild a "DOS application", it is a command-line application. (DOS stopped being viable some 30 years ago.) – RenniePet Aug 26 '14 at 15:54
  • @SNash, are you running the application in debug mode? It appears that way, as I'm seeing a lot of "vshost" in the build output. Also, switch your "Show output from" in the Build drop-down at the top of the output window from "Debug" to "Build." Then, instead of F5/run debug, do a full build/rebuild by either selecting from the Build menu or Ctrl+Shift+B. – AJ. Aug 26 '14 at 16:21
  • See edit to my answer. – AJ. Aug 26 '14 at 16:24
  • 1
    Possible duplicate of [Is there a way to get the build command line used by Visual Studio?](https://stackoverflow.com/questions/19822603/is-there-a-way-to-get-the-build-command-line-used-by-visual-studio) – Ken Kin Dec 30 '17 at 06:59

1 Answers1

11

I think what you're looking for can be set up in your VS environment options. Under the Tools menu, select "Options," then "Projects and Solutions." Make sure "Show Output window when build starts" is checked.

Show Output

Then, under "Projects and Solutions," select "Build and Run" and change the level of "MSBuild project build output verbosity." I changed it to "Detailed" as an experiment, but you can fiddle with the levels to get what you want.

Output Verbosity

Then, when you build/rebuild your solution, the easiest thing to do is to place your cursor in the build output window and search for "csc" (or "vbc" for VB). You should be able to see the entire command line call to the compiler.

Build Output

EDIT
To answer your comment, change the "Show output from" drop-down option at the top of the output window from "Debug" to "Build" and do a build/rebuild without running the application in debug mode.

Show Output From

AJ.
  • 16,368
  • 20
  • 95
  • 150