Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I use the <code>/v:diagnostic</code> command-line switch. MSBuild spits out some pretty verbose output. You can also spit the verbose output to a log file instead of the console, using the <code>/fl[n]</code> command line switch, and then use the <code>/flp[n]</code> (filelogparameter) switch to specify the verbosity level, e.g., <code>/flp:Verbosity=diagnostic;LogFile=latest_diagnostic.log</code></p> <p>You have to design your build scripts from the start to make troubleshooting easier. Do things like:</p> <p>Make each target as granular as possible, so you can call each target individually. This helps make the debugging process much quicker.</p> <p>Make sure your tasks inherit from the <code>Microsoft.Build.Utilities.Task</code> class. It exposes a Log property that has way too many logging functions. I typically err on the side of caution use the <code>LogMessage(MessageImportance,string,params object[])</code>. My debugging messages get a message importance of <code>MessageImportance.Low</code> so they only appear when the verbosity mode is diagnostic.</p> <p>Use <code>System.Diagnostics.Trace.WriteLine</code> for outputting messages that are are too low-level to log. I use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx" rel="noreferrer">DebugView</a> to look at those messages.</p> <p>Lastly, try not to do really complicated things in the MSBuild script itself. MSBuild excels at managing dependencies, lists of files, and running tasks. Anything more complicated or advanced should be moved to custom tasks written in your .NET language of choice. This has the added benefit of making things <em>much</em> easier to debug. When you've got your logic in code, you can use <code>System.Diagnostics.Debugger.Launch()</code> method, which will allow you to attach MSBuild to the debugger in a running instance of Visual Studio (hopefully one that has your custom task already loaded).</p> <p>Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload