Debug your Microsoft Teams app locally using Microsoft Visual Studio
Visual Studio allows you to debug tabs, bots, and message extensions. You can debug your app locally in Visual Studio using Microsoft Teams Toolkit by performing:
Set up dev tunnel (Only for bot and message extension)
In the debug dropdown menu:
Select Dev Tunnels.
If you have already an existing dev tunnel, select the existing tunnel from the list. For example, in the following image PublicDevTunnel is an existing dev tunnel.
If you haven't created a tunnel, select Create a Tunnel.... A new window appears.
Enter the name of the dev tunnel and under Access select Public from the dropdown.
Select OK.
Set up your Teams Toolkit
To debug your app after you create a project, perform the following steps:
Right-click on your project.
Select Teams Toolkit > Prepare Teams App Dependencies.
Note
In this scenario the project name is MyTeamsApp1.
Your Microsoft 365 account needs to have the custom app upload permission before you sign in. Ensure that your Teams app can be uploaded to the tenant, otherwise your Teams app can fail to run in Teams Client.
Sign in to your Microsoft 365 Account and then select Continue.
Note
Learn more about the custom app upload permission, see prepare your Microsoft 365 tenant.
Select Debug > Start Debugging or select F5.
Visual Studio launches the Teams app inside Microsoft Teams client in your browser. For more information, see Teams Toolkit Overview.
Select Add to install your app in Teams.
You can also use the hot reload function of Visual Studio during debug. For more information, see .NET hot reload.
Note
When you debug a notification bot app, ensure that you post HTTP request to
http://localhost:5130/api/notification
in order to trigger notification. If you've selected HTTP trigger when creating the project, you can use any API tools such as, cURL (Windows Command Prompt), Postman, or any other API tool.Before you try to run the Teams app locally, if you make any changes to the app manifest (previously called Teams app manifest) file
/appPackage/manifest.json
, ensure that you perform the Prepare Teams App Dependencies command.
Next step
See also
Platform Docs