Is it possible to output the command-line used to build a project in Visual Studio?

Published 30 November 04 02:54 PM

Now that Whidbey has been out in Beta for more than a few months, it seems worth revisiting some frequently asked questions which have different (better?) answers now.

In Everett (v7.1) the answer used to be No.

However, in Whidbey (v8.0), the answer is Yes (and No).

For the yes part of the answer, after building, go to the Output Window, select "Show Output from: Build", and about half way down you will see a section like this:

Target "Compile" in project "ConsoleApplication1.csproj"

Task "Csc"

Csc.exe /noconfig /warn:4 /define:DEBUG;TRACE /debug+ /optimize- /out:obj\Debug\ConsoleApplication1.exe /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.31125\System.Data.dll, C:\WINDOWS.0\Microsoft.NET\Framework\v2.0.31125\System.XML.dll, C:\WINDOWS\Microsoft.NET\Framework\v2.0.31125\System.dll /target:exe /win32icon:App.ico AssemblyInfo.cs Class1.cs

The task is invoking the IDE's in-process compiler to perform the equivalent of the above command-line.

Now for the no part of the answer. The project system does not actually execute this command line as part of the build process. As the output says, the IDE directly calls its own in-process compiler to perform the equivalent. However, in all cases, you should get the same results using the command line suggested in the output window. If you don't, you could be looking at a bug.

Note: before you cut and paste the build output to the command line, remember to add the path to CSC.EXE

[Author: SantoshZ]

Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# William Robertson said on November 30, 2004 3:41 PM:
So has Everett changed?

"In Everett (v7.1) the answer used to be No." Is the answer yes now?
# SantoshZ said on December 1, 2004 6:03 PM:
William,

Sorry, the answer continues to be 'No' for Everett.
# Jason Haley said on December 5, 2004 9:06 AM:
More interesting finds this weekend
# FAQ C# said on April 13, 2005 8:49 AM:
# FAQ C# (par Yannick Lejeune) said on August 23, 2005 5:11 AM:
# FAQ C# (par Yannick Lejeune) said on August 23, 2005 5:33 AM:

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

This Blog

Syndication

Page view tracker