Skip to content

Debug with Multiple Profiles in Teams Toolkit for Visual Studio

Alive-Fish edited this page May 15, 2024 · 5 revisions

Prerequisite

  1. Important: Visual Studio version >= 17.10 Preview 3

Debug with "Multi-Project Launch Profiles" Preview Feature

To use this feature:

  1. Go to Tools -> Options -> Preview Features
  2. Select 'Enable Multi-Project Launch Profiles'
    image

Start the app in Outlook

  1. Select Outlook (browser) in debug dropdown menu
    image
  2. Press F5, or select Debug > Start Debugging menu in Visual Studio
    image

Start the app in Teams App Test Tool

Note: if your template is AI Assistant Bot you should fill in both OpenAI API Key and the created Assistant ID into appsettings.TestTool.json

"OpenAI": {
   "ApiKey": "<your-openai-api-key>",
   "AssistantId": "<your-openai-assistant-id>"
}

If your template is AI Chat Bot, you should fill in your OpenAI API Key or Azure OpenAI settings in appsettings.TestTool.json

# If using OpenAI
"OpenAI": {
  "ApiKey": "<your-openai-api-key>"
},
# If using Azure OpenAI
"Azure": {
  "OpenAIApiKey": "<your-azure-openai-api-key>",
  "OpenAIEndpoint": "<your-azure-openai-endpoint>"
}

If using Azure OpenAI, update "gpt-35-turbo" in Program.cs to your own model deployment name

  1. Select Teams App Test Tool (browser) in the debug dropdown menu
    image
  2. Press F5, or select Debug > Start Debugging menu in Visual Studio
    image

Others

Same as above, select the pre-defined profile from the debug dropdown menu.

Debug without "Multi-Project Launch Profiles" Preview Feature

Start the app in Outlook

  1. Select TeamsApp in the project selection dropdown menu.
    image
  2. Select Outlook (browser) in the debug dropdown menu.
    image
  3. Select Configure Startup Projects... in the debug dropdown menu.
    image
  4. In the popup dialog, select Multiple startup projects and configure the Action as Start. Then click "Apply" and "OK".
    image
  5. Press F5, or select Debug > Start Debugging menu in Visual Studio
    image

Start the app in Teams App Test Tool

Note: if your template is AI Assistant Bot you should fill in both OpenAI API Key and the created Assistant ID into appsettings.TestTool.json

"OpenAI": {
   "ApiKey": "<your-openai-api-key>",
   "AssistantId": "<your-openai-assistant-id>"
}

If your template is AI Chat Bot, you should fill in your OpenAI API Key or Azure OpenAI settings in appsettings.TestTool.json

# If using OpenAI
"OpenAI": {
  "ApiKey": "<your-openai-api-key>"
},
# If using Azure OpenAI
"Azure": {
  "OpenAIApiKey": "<your-azure-openai-api-key>",
  "OpenAIEndpoint": "<your-azure-openai-endpoint>"
}

If using Azure OpenAI, update "gpt-35-turbo" in Program.cs to your own model deployment name

  1. Select TeamsApp in the project selection dropdown menu.
    image
  2. Select Teams App Test Tool (browser) in the debug dropdown menu.
    image
  3. Select {{YOUR_CSHARP_PROJECT}} in the project selection dropdown menu, such as MyTeamsApp1.
    image
  4. Select Teams App Test Tool in the debug dropdown menu.
    image
  5. Select Configure Startup Projects... in the debug dropdown menu.
    image
  6. In the popup dialog, select Multiple startup projects and configure the Action as Start. Then click "Apply" and "OK".
    image
  7. Press F5, or select Debug > Start Debugging menu in Visual Studio
    image

Others

Same as above, select the correct profile of the TeamsApp and {{YOUR_CSHARP_PROJECT}}, configure Multiple startup projects and then start it.

Clone this wiki locally