Update (7 June 2012): Instructions when using Visual Studio 2012
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.
Now that we’ve enabled logging of VC++ messages, we need a way to view them. You have a few options here. You can pick any ONE of the following:
- Configure the System.Diagnostics trace to be logged to a text file.
- DebugView is a free Sysinternals tool that displays all log messages on screen and doesn’t require any installation.
- Attach a debugger to the devenv.exe process (perhaps another instance of devenv.exe) and watch the Debug pane of the Output window (Debug –> Windows –> Output).
Regardless of how you view the resulting log messages, you may find that they are quite verbose. Many services in Visual Studio 2010 log messages and many of these are “on by default” (VC++ logging is off by default, which is why we modified the .config file). Try a keyword search to scan for the messages that you’re interested in and then scan through the surrounding messages to find the ones that can help identify whatever you’re investigating.
Here’s a sample picture of DebugView showing the relevant log message explaining why a special project type doesn’t get standard up-to-date check behavior in the IDE: