C# Frequently Asked Questions

The C# team posts answers to common questions

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

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]

Published Tuesday, November 30, 2004 2:54 PM by CSharpFAQ
Filed under: , ,

Comments

 

William Robertson said:

So has Everett changed?

"In Everett (v7.1) the answer used to be No." Is the answer yes now?
November 30, 2004 3:41 PM
 

SantoshZ said:

William,

Sorry, the answer continues to be 'No' for Everett.
December 1, 2004 6:03 PM
 

Jason Haley said:

More interesting finds this weekend
December 5, 2004 9:06 AM
 

FAQ C# said:

April 13, 2005 8:49 AM
 

FAQ C# (par Yannick Lejeune) said:

August 23, 2005 5:11 AM
 

FAQ C# (par Yannick Lejeune) said:

August 23, 2005 5:33 AM
Anonymous comments are disabled

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker