Debugging VSTO Using Log Files or Alerts
Issue
VSTO isn’t functioning as expected and I need to debug it conveniently
Resolution

Visual Studio Tools for Office can write all errors that occur during startup to a log file or display each error in a message box. To enable or disable this logging, the user needs to adjust two Windows environment variables.

Managing Environment Variables

Any user can add, modify, or remove a user environment variable. The changes are written to the registry, and are usually effective immediately. However, after a change to user environment variables is made, any open software programs should be restarted to force them to read the new registry values.

Environment Variables.png
Environment Variables 2.png

For information about setting environment variables in Microsoft Windows XP, see "How To Manage Environment Variables in Windows XP"

(http://support.microsoft.com/default.aspx?scid=kb;en-us;310519).

Displaying VSTO Alert Prompts

To display each error in a message box, set the VSTO_SUPPRESSDISPLAYALERTS variable to 0 (zero). You can suppress the messages by setting the variable to 1 (one).

New User Variable.png

Environment Variables 3.png
Logging VSTO Alerts to a Log file

To write the errors to a log file, set the VSTO_LOGALERTS variable to 1 (one).

New User Variable 2.png
Environment Variables 4.png
Visual Studio Tools for Office creates the log file in the folder that contains the application manifest. The default name is .manifest.log. To stop logging errors, set the variable to 0 (zero).

Last updated 5/3/2011