Redigera

Dela via


Debug function commands in Outlook add-ins

Note

The technique in this article can be used only on a Windows development computer. If you're developing on a Mac, see Debug function commands.

This article describes how to use the Office Add-in Debugger Extension in Visual Studio Code to debug function commands. Function commands are initiated through an add-in command button on the ribbon. For more information about add-in commands, see Add-in commands.

This article assumes that you already have an add-in project that you'd like to debug. To create an add-in with a function command to practice debugging, follow the steps in Tutorial: Build a message compose Outlook add-in.

Mark your add-in for debugging

If you used the Yeoman generator for Office Add-ins to create your add-in project, skip to the Configure and run the debugger section later in this article. When you run npm start to build your add-in and start the local server, the command also sets the UseDirectDebugger value of the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\WEF\Developer\[Add-in ID] registry key to mark your add-in for debugging.

Otherwise, if you used another tool to create your add-in, perform the following steps.

  1. Navigate to the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\WEF\Developer\[Add-in ID] registry key. Replace [Add-in ID] with the <Id> from your add-in's manifest.

    Note

    If the Developer key (folder) doesn't already exist under HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\WEF\, complete the following steps to create it.

    1. Right-click (or select and hold) the WEF key (folder) and select New > Key.
    2. Name the new key Developer.
  2. Set the key's UseDirectDebugger value to 1.

Configure and run the debugger

Now that you've enabled debugging on your add-in, you're ready to configure and run the debugger. For instructions on how to do this, select one of the following options that applies to your webview control. For information about how to determine what webview control is used on your development computer, see Browsers and webview controls used by Office Add-ins.

See also