Monday, January 16, 2012

Enable C++ project system logging

The new Visual C++ project system in Visual Studio 2010 leverages the .NET System.Diagnostics trace logging feature to help users investigate why certain operations have failed or just to better understand what is happening behind the scenes.

Here are some features that VC++ logs lots of messages about so you can diagnose any bad behavior:

    Design-time build failures, such as project, COM, or assembly references that won’t resolve
    Project filters
    IDE build up-to-date check

In order to avoid negatively impacting performance in the common case where you don’t care to review the trace logs, we only emit the trace messages when a user “opts in” to logging these messages.  To enable logging in the Visual C++ project system you just have to add a snippet to a .config file:

    Since it can be difficult to recover from a damaged devenv.exe.config file, consider copying the file to devenv.exe.config.original before modifying it so you have a backup copy you can revert to if things go awry.
    Open a text editor with admin privileges.
    Open your %PROGRAMFILES%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config file.  Note this will be in %ProgramFiles(x86)% on 64-bit Windows.
    Add this snippet to your devenv.exe.config file just below the <configSections /> block:

    <system.diagnostics>
      <switches>
        <add name="CPS" value="4" />
      </switches>
    </system.diagnostics>

    Save the text file.

You can find out more about setting traceswitch verbosity levels on MSDN.  Why the name “CPS” for our trace switch?  Just an implementation detail for this release.


Read more: VS Project Team Blog
QR: enable-c-project-system-logging.aspx

Posted via email from Jasper-Net