From 818398007f58307bd938ba8cb01f5bf457a6c037 Mon Sep 17 00:00:00 2001 From: qinezh Date: Tue, 19 Dec 2023 10:48:59 +0800 Subject: [PATCH] fix: update C# bot app template for Test Tool (#10538) --- ...ettingStarted.md => GettingStarted.md.tpl} | 27 +++++++++++++++++++ .../Properties/launchSettings.json.tpl | 6 +++-- .../appsettings.TestTool.json | 1 - ...ettingStarted.md => GettingStarted.md.tpl} | 20 ++++++++++++++ .../ai-bot/Properties/launchSettings.json.tpl | 6 +++-- .../csharp/ai-bot/appsettings.TestTool.json | 1 - ...ettingStarted.md => GettingStarted.md.tpl} | 6 +++++ .../Properties/launchSettings.json.tpl | 6 +++-- .../appsettings.TestTool.json | 3 +-- ...ettingStarted.md => GettingStarted.md.tpl} | 7 ++++- .../Properties/launchSettings.json.tpl | 6 +++-- .../default-bot/appsettings.TestTool.json | 3 +-- ...ettingStarted.md => GettingStarted.md.tpl} | 11 ++++++++ .../Properties/launchSettings.json.tpl | 8 +++--- .../appsettings.TestTool.json | 3 +-- .../{{ProjectName}}.csproj.tpl | 6 +++++ ...ettingStarted.md => GettingStarted.md.tpl} | 11 ++++++++ .../Properties/launchSettings.json.tpl | 8 +++--- .../appsettings.TestTool.json | 3 +-- .../{{ProjectName}}.csproj.tpl | 6 +++++ ...ettingStarted.md => GettingStarted.md.tpl} | 11 ++++++++ .../Properties/launchSettings.json.tpl | 8 +++--- .../appsettings.TestTool.json | 3 +-- .../{{ProjectName}}.csproj.tpl | 6 +++++ ...ettingStarted.md => GettingStarted.md.tpl} | 10 +++++++ .../Properties/launchSettings.json.tpl | 6 +++-- .../appsettings.TestTool.json | 3 +-- .../{{ProjectName}}.csproj.tpl | 1 + ...ettingStarted.md => GettingStarted.md.tpl} | 6 +++++ .../Properties/launchSettings.json.tpl | 6 +++-- .../csharp/workflow/appsettings.TestTool.json | 3 +-- 31 files changed, 173 insertions(+), 38 deletions(-) rename templates/csharp/ai-assistant-bot/{GettingStarted.md => GettingStarted.md.tpl} (80%) rename templates/csharp/ai-bot/{GettingStarted.md => GettingStarted.md.tpl} (80%) rename templates/csharp/command-and-response/{GettingStarted.md => GettingStarted.md.tpl} (78%) rename templates/csharp/default-bot/{GettingStarted.md => GettingStarted.md.tpl} (77%) rename templates/csharp/notification-http-timer-trigger/{GettingStarted.md => GettingStarted.md.tpl} (72%) rename templates/csharp/notification-http-trigger/{GettingStarted.md => GettingStarted.md.tpl} (72%) rename templates/csharp/notification-timer-trigger/{GettingStarted.md => GettingStarted.md.tpl} (72%) rename templates/csharp/notification-webapi/{GettingStarted.md => GettingStarted.md.tpl} (74%) rename templates/csharp/workflow/{GettingStarted.md => GettingStarted.md.tpl} (78%) diff --git a/templates/csharp/ai-assistant-bot/GettingStarted.md b/templates/csharp/ai-assistant-bot/GettingStarted.md.tpl similarity index 80% rename from templates/csharp/ai-assistant-bot/GettingStarted.md rename to templates/csharp/ai-assistant-bot/GettingStarted.md.tpl index 9806934f02..01d6a7d783 100644 --- a/templates/csharp/ai-assistant-bot/GettingStarted.md +++ b/templates/csharp/ai-assistant-bot/GettingStarted.md.tpl @@ -29,6 +29,26 @@ Before running or debugging your bot, please follow these steps to setup your ow > . ./Create-Assistant.ps1 -OPENAI_API_KEY xxxxxx ``` 1. The above command will output the properties of the new created assistant, including the ID like "id: asst_xxx..." +{{#enableTestToolByDefault}} +1. Fill in both OpenAI API Key and the created Assistant ID into `appsettings.TestTool.json` + ``` + "OpenAI": { + "ApiKey": "", + "AssistantId": "" + } + ``` + +**If you already have an Assistant created** + +1. Fill in both OpenAI API Key and the created Assistant ID into `appsettings.TestTool.json` + ``` + "OpenAI": { + "ApiKey": "", + "AssistantId": "" + } + ``` +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. Fill in both OpenAI API Key and the created Assistant ID into `env/.env.local.user` ``` SECRET_OPENAI_API_KEY= @@ -42,9 +62,15 @@ Before running or debugging your bot, please follow these steps to setup your ow SECRET_OPENAI_API_KEY= SECRET_OPENAI_ASSISTANT_ID= ``` +{{/enableTestToolByDefault}} ### Run Teams Bot locally +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +1. In Teams App Test Tool from the launched browser, type and send anything to your bot to trigger a response +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 1. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 1. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -52,6 +78,7 @@ to install the app to 1. Press F5, or select the Debug > Start Debugging menu in Visual Studio 1. In the launched browser, select the Add button to load the app in Teams 1. In the chat bar, type and send anything to your bot to trigger a response +{{/enableTestToolByDefault}} ## Extend the AI Assistant Bot template with more AI capabilities diff --git a/templates/csharp/ai-assistant-bot/Properties/launchSettings.json.tpl b/templates/csharp/ai-assistant-bot/Properties/launchSettings.json.tpl index 3f6bfe432e..312b16764c 100644 --- a/templates/csharp/ai-assistant-bot/Properties/launchSettings.json.tpl +++ b/templates/csharp/ai-assistant-bot/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, @@ -37,7 +38,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, diff --git a/templates/csharp/ai-assistant-bot/appsettings.TestTool.json b/templates/csharp/ai-assistant-bot/appsettings.TestTool.json index 4fba0e225b..3f1f56a0cb 100644 --- a/templates/csharp/ai-assistant-bot/appsettings.TestTool.json +++ b/templates/csharp/ai-assistant-bot/appsettings.TestTool.json @@ -9,7 +9,6 @@ "AllowedHosts": "*", "BOT_ID": "", "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "OpenAI": { "ApiKey": "", "AssistantId": "" diff --git a/templates/csharp/ai-bot/GettingStarted.md b/templates/csharp/ai-bot/GettingStarted.md.tpl similarity index 80% rename from templates/csharp/ai-bot/GettingStarted.md rename to templates/csharp/ai-bot/GettingStarted.md.tpl index ab5b42591a..db474f955f 100644 --- a/templates/csharp/ai-bot/GettingStarted.md +++ b/templates/csharp/ai-bot/GettingStarted.md.tpl @@ -11,6 +11,25 @@ The app template is built using the Teams AI library, which provides the capabil > > - [Azure OpenAI](https://aka.ms/oai/access) resource or an account with [OpenAI](https://platform.openai.com). +{{#enableTestToolByDefault}} +1. Fill in your OpenAI API Key or Azure OpenAI settings in `appsettings.TestTool.json` +``` +# If using OpenAI +"OpenAI": { + "ApiKey": "" +}, + +# If using Azure OpenAI +"Azure": { + "OpenAIApiKey": "", + "OpenAIEndpoint": "" +} +``` + +2. Press F5, or select the Debug > Start Debugging menu in Visual Studio +3. In Teams App Test Tool from the launched browser, type and send anything to your bot to trigger a response +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. Fill in your OpenAI API Key or Azure OpenAI settings in `env/.env.local.user` ``` # If using OpenAI @@ -28,6 +47,7 @@ to install the app to 5. Press F5, or select the Debug > Start Debugging menu in Visual Studio 6. In the launched browser, select the Add button to load the app in Teams 7. In the chat bar, type and send anything to your bot to trigger a response +{{/enableTestToolByDefault}} ## Extend the AI Chat Bot template with more AI capabilities diff --git a/templates/csharp/ai-bot/Properties/launchSettings.json.tpl b/templates/csharp/ai-bot/Properties/launchSettings.json.tpl index 3f6bfe432e..312b16764c 100644 --- a/templates/csharp/ai-bot/Properties/launchSettings.json.tpl +++ b/templates/csharp/ai-bot/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, @@ -37,7 +38,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, diff --git a/templates/csharp/ai-bot/appsettings.TestTool.json b/templates/csharp/ai-bot/appsettings.TestTool.json index 313b1693ed..9c03259ce9 100644 --- a/templates/csharp/ai-bot/appsettings.TestTool.json +++ b/templates/csharp/ai-bot/appsettings.TestTool.json @@ -9,7 +9,6 @@ "AllowedHosts": "*", "BOT_ID": "", "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "OpenAI": { "ApiKey": "" }, diff --git a/templates/csharp/command-and-response/GettingStarted.md b/templates/csharp/command-and-response/GettingStarted.md.tpl similarity index 78% rename from templates/csharp/command-and-response/GettingStarted.md rename to templates/csharp/command-and-response/GettingStarted.md.tpl index 61a9e61e13..8506c51770 100644 --- a/templates/csharp/command-and-response/GettingStarted.md +++ b/templates/csharp/command-and-response/GettingStarted.md.tpl @@ -2,6 +2,11 @@ ## Quick Start +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. In Teams App Test Tool from the launched browser, type and send "helloWorld" to your app to trigger a response +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 3. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -9,6 +14,7 @@ to install the app to 4. Press F5, or select the Debug > Start Debugging menu in Visual Studio 5. In the launched browser, select the Add button to load the app in Teams 6. In the chat bar, type and send "helloWorld" to your app to trigger a response +{{/enableTestToolByDefault}} ## Learn more diff --git a/templates/csharp/command-and-response/Properties/launchSettings.json.tpl b/templates/csharp/command-and-response/Properties/launchSettings.json.tpl index 59e957f91f..5339d2af26 100644 --- a/templates/csharp/command-and-response/Properties/launchSettings.json.tpl +++ b/templates/csharp/command-and-response/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, @@ -37,7 +38,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, diff --git a/templates/csharp/command-and-response/appsettings.TestTool.json b/templates/csharp/command-and-response/appsettings.TestTool.json index c041caeef4..1a3d21d69a 100644 --- a/templates/csharp/command-and-response/appsettings.TestTool.json +++ b/templates/csharp/command-and-response/appsettings.TestTool.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file diff --git a/templates/csharp/default-bot/GettingStarted.md b/templates/csharp/default-bot/GettingStarted.md.tpl similarity index 77% rename from templates/csharp/default-bot/GettingStarted.md rename to templates/csharp/default-bot/GettingStarted.md.tpl index cc8524b5db..79083a58a6 100644 --- a/templates/csharp/default-bot/GettingStarted.md +++ b/templates/csharp/default-bot/GettingStarted.md.tpl @@ -1,7 +1,11 @@ # Welcome to Teams Toolkit! ## Quick Start - +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. In Teams App Test Tool from the launched browser, type and send anything to your bot to trigger a response +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 3. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -9,6 +13,7 @@ to install the app to 4. Press F5, or select the Debug > Start Debugging menu in Visual Studio 5. In the launched browser, select the Add button to load the app in Teams 6. In the chat bar, type and send anything to your bot to trigger a response +{{/enableTestToolByDefault}} ## Learn more diff --git a/templates/csharp/default-bot/Properties/launchSettings.json.tpl b/templates/csharp/default-bot/Properties/launchSettings.json.tpl index 3f6bfe432e..312b16764c 100644 --- a/templates/csharp/default-bot/Properties/launchSettings.json.tpl +++ b/templates/csharp/default-bot/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, @@ -37,7 +38,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, diff --git a/templates/csharp/default-bot/appsettings.TestTool.json b/templates/csharp/default-bot/appsettings.TestTool.json index c041caeef4..1a3d21d69a 100644 --- a/templates/csharp/default-bot/appsettings.TestTool.json +++ b/templates/csharp/default-bot/appsettings.TestTool.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file diff --git a/templates/csharp/notification-http-timer-trigger/GettingStarted.md b/templates/csharp/notification-http-timer-trigger/GettingStarted.md.tpl similarity index 72% rename from templates/csharp/notification-http-timer-trigger/GettingStarted.md rename to templates/csharp/notification-http-timer-trigger/GettingStarted.md.tpl index 3c3d12b7bf..6d3252b17e 100644 --- a/templates/csharp/notification-http-timer-trigger/GettingStarted.md +++ b/templates/csharp/notification-http-timer-trigger/GettingStarted.md.tpl @@ -2,6 +2,16 @@ ## Quick Start +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. Teams App Test Tool will be opened in the launched browser +3. [If you selected http trigger] Open Windows PowerShell and post a HTTP request to trigger +the notification(replace with real endpoint, for example localhost:5130): + + Invoke-WebRequest -Uri "http:///api/notification" -Method Post + +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 3. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -13,6 +23,7 @@ the notification(replace with real endpoint, for example localhost:51 Invoke-WebRequest -Uri "http:///api/notification" -Method Post +{{/enableTestToolByDefault}} ## Learn more New to Teams app development or Teams Toolkit? Learn more about diff --git a/templates/csharp/notification-http-timer-trigger/Properties/launchSettings.json.tpl b/templates/csharp/notification-http-timer-trigger/Properties/launchSettings.json.tpl index fff3ff0fc1..54414ee25a 100644 --- a/templates/csharp/notification-http-timer-trigger/Properties/launchSettings.json.tpl +++ b/templates/csharp/notification-http-timer-trigger/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchTestTool": true, "launchUrl": "http://localhost:56150", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool", + "AZURE_FUNCTIONS_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, @@ -23,7 +24,7 @@ "launchBrowser": true, "launchUrl": "https://teams.microsoft.com/l/app/${{TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&appTenantId=${{TEAMS_APP_TENANT_ID}}&login_hint=${{TEAMSFX_M365_USER_NAME}}", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, @@ -37,7 +38,8 @@ "launchTestTool": true, "launchUrl": "http://localhost:56150", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool", + "AZURE_FUNCTIONS_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, diff --git a/templates/csharp/notification-http-timer-trigger/appsettings.TestTool.json b/templates/csharp/notification-http-timer-trigger/appsettings.TestTool.json index 75d5a8a402..bafb898515 100644 --- a/templates/csharp/notification-http-timer-trigger/appsettings.TestTool.json +++ b/templates/csharp/notification-http-timer-trigger/appsettings.TestTool.json @@ -1,5 +1,4 @@ { "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file diff --git a/templates/csharp/notification-http-timer-trigger/{{ProjectName}}.csproj.tpl b/templates/csharp/notification-http-timer-trigger/{{ProjectName}}.csproj.tpl index a99bf9a514..e5725b8182 100644 --- a/templates/csharp/notification-http-timer-trigger/{{ProjectName}}.csproj.tpl +++ b/templates/csharp/notification-http-timer-trigger/{{ProjectName}}.csproj.tpl @@ -18,6 +18,7 @@ + @@ -56,6 +57,11 @@ PreserveNewest Never + + appsettings.json + PreserveNewest + Never + diff --git a/templates/csharp/notification-http-trigger/GettingStarted.md b/templates/csharp/notification-http-trigger/GettingStarted.md.tpl similarity index 72% rename from templates/csharp/notification-http-trigger/GettingStarted.md rename to templates/csharp/notification-http-trigger/GettingStarted.md.tpl index 3c3d12b7bf..6d3252b17e 100644 --- a/templates/csharp/notification-http-trigger/GettingStarted.md +++ b/templates/csharp/notification-http-trigger/GettingStarted.md.tpl @@ -2,6 +2,16 @@ ## Quick Start +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. Teams App Test Tool will be opened in the launched browser +3. [If you selected http trigger] Open Windows PowerShell and post a HTTP request to trigger +the notification(replace with real endpoint, for example localhost:5130): + + Invoke-WebRequest -Uri "http:///api/notification" -Method Post + +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 3. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -13,6 +23,7 @@ the notification(replace with real endpoint, for example localhost:51 Invoke-WebRequest -Uri "http:///api/notification" -Method Post +{{/enableTestToolByDefault}} ## Learn more New to Teams app development or Teams Toolkit? Learn more about diff --git a/templates/csharp/notification-http-trigger/Properties/launchSettings.json.tpl b/templates/csharp/notification-http-trigger/Properties/launchSettings.json.tpl index fff3ff0fc1..54414ee25a 100644 --- a/templates/csharp/notification-http-trigger/Properties/launchSettings.json.tpl +++ b/templates/csharp/notification-http-trigger/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchTestTool": true, "launchUrl": "http://localhost:56150", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool", + "AZURE_FUNCTIONS_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, @@ -23,7 +24,7 @@ "launchBrowser": true, "launchUrl": "https://teams.microsoft.com/l/app/${{TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&appTenantId=${{TEAMS_APP_TENANT_ID}}&login_hint=${{TEAMSFX_M365_USER_NAME}}", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, @@ -37,7 +38,8 @@ "launchTestTool": true, "launchUrl": "http://localhost:56150", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool", + "AZURE_FUNCTIONS_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, diff --git a/templates/csharp/notification-http-trigger/appsettings.TestTool.json b/templates/csharp/notification-http-trigger/appsettings.TestTool.json index 75d5a8a402..bafb898515 100644 --- a/templates/csharp/notification-http-trigger/appsettings.TestTool.json +++ b/templates/csharp/notification-http-trigger/appsettings.TestTool.json @@ -1,5 +1,4 @@ { "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file diff --git a/templates/csharp/notification-http-trigger/{{ProjectName}}.csproj.tpl b/templates/csharp/notification-http-trigger/{{ProjectName}}.csproj.tpl index a99bf9a514..e5725b8182 100644 --- a/templates/csharp/notification-http-trigger/{{ProjectName}}.csproj.tpl +++ b/templates/csharp/notification-http-trigger/{{ProjectName}}.csproj.tpl @@ -18,6 +18,7 @@ + @@ -56,6 +57,11 @@ PreserveNewest Never + + appsettings.json + PreserveNewest + Never + diff --git a/templates/csharp/notification-timer-trigger/GettingStarted.md b/templates/csharp/notification-timer-trigger/GettingStarted.md.tpl similarity index 72% rename from templates/csharp/notification-timer-trigger/GettingStarted.md rename to templates/csharp/notification-timer-trigger/GettingStarted.md.tpl index 3c3d12b7bf..6d3252b17e 100644 --- a/templates/csharp/notification-timer-trigger/GettingStarted.md +++ b/templates/csharp/notification-timer-trigger/GettingStarted.md.tpl @@ -2,6 +2,16 @@ ## Quick Start +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. Teams App Test Tool will be opened in the launched browser +3. [If you selected http trigger] Open Windows PowerShell and post a HTTP request to trigger +the notification(replace with real endpoint, for example localhost:5130): + + Invoke-WebRequest -Uri "http:///api/notification" -Method Post + +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 3. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -13,6 +23,7 @@ the notification(replace with real endpoint, for example localhost:51 Invoke-WebRequest -Uri "http:///api/notification" -Method Post +{{/enableTestToolByDefault}} ## Learn more New to Teams app development or Teams Toolkit? Learn more about diff --git a/templates/csharp/notification-timer-trigger/Properties/launchSettings.json.tpl b/templates/csharp/notification-timer-trigger/Properties/launchSettings.json.tpl index fff3ff0fc1..54414ee25a 100644 --- a/templates/csharp/notification-timer-trigger/Properties/launchSettings.json.tpl +++ b/templates/csharp/notification-timer-trigger/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchTestTool": true, "launchUrl": "http://localhost:56150", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool", + "AZURE_FUNCTIONS_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, @@ -23,7 +24,7 @@ "launchBrowser": true, "launchUrl": "https://teams.microsoft.com/l/app/${{TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&appTenantId=${{TEAMS_APP_TENANT_ID}}&login_hint=${{TEAMSFX_M365_USER_NAME}}", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, @@ -37,7 +38,8 @@ "launchTestTool": true, "launchUrl": "http://localhost:56150", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool", + "AZURE_FUNCTIONS_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json", "TEAMSFX_NOTIFICATION_LOCALSTORE_DIR": "../../.." // Path to project folder $(MSBuildProjectDirectory) } }, diff --git a/templates/csharp/notification-timer-trigger/appsettings.TestTool.json b/templates/csharp/notification-timer-trigger/appsettings.TestTool.json index 75d5a8a402..bafb898515 100644 --- a/templates/csharp/notification-timer-trigger/appsettings.TestTool.json +++ b/templates/csharp/notification-timer-trigger/appsettings.TestTool.json @@ -1,5 +1,4 @@ { "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file diff --git a/templates/csharp/notification-timer-trigger/{{ProjectName}}.csproj.tpl b/templates/csharp/notification-timer-trigger/{{ProjectName}}.csproj.tpl index a99bf9a514..e5725b8182 100644 --- a/templates/csharp/notification-timer-trigger/{{ProjectName}}.csproj.tpl +++ b/templates/csharp/notification-timer-trigger/{{ProjectName}}.csproj.tpl @@ -18,6 +18,7 @@ + @@ -56,6 +57,11 @@ PreserveNewest Never + + appsettings.json + PreserveNewest + Never + diff --git a/templates/csharp/notification-webapi/GettingStarted.md b/templates/csharp/notification-webapi/GettingStarted.md.tpl similarity index 74% rename from templates/csharp/notification-webapi/GettingStarted.md rename to templates/csharp/notification-webapi/GettingStarted.md.tpl index d68d79ae60..bd15b6acd1 100644 --- a/templates/csharp/notification-webapi/GettingStarted.md +++ b/templates/csharp/notification-webapi/GettingStarted.md.tpl @@ -2,6 +2,15 @@ ## Quick Start +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. Teams App Test Tool will be opened in the launched browser +3. Open Windows PowerShell and post a HTTP request to trigger the notification: + + Invoke-WebRequest -Uri "http://localhost:5130/api/notification" -Method Post + +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies 3. If prompted, sign in with a Microsoft 365 account for the Teams organization you want @@ -12,6 +21,7 @@ to install the app to Invoke-WebRequest -Uri "http://localhost:5130/api/notification" -Method Post +{{/enableTestToolByDefault}} ## Learn more New to Teams app development or Teams Toolkit? Learn more about diff --git a/templates/csharp/notification-webapi/Properties/launchSettings.json.tpl b/templates/csharp/notification-webapi/Properties/launchSettings.json.tpl index 3f6bfe432e..312b16764c 100644 --- a/templates/csharp/notification-webapi/Properties/launchSettings.json.tpl +++ b/templates/csharp/notification-webapi/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, @@ -37,7 +38,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, diff --git a/templates/csharp/notification-webapi/appsettings.TestTool.json b/templates/csharp/notification-webapi/appsettings.TestTool.json index c041caeef4..1a3d21d69a 100644 --- a/templates/csharp/notification-webapi/appsettings.TestTool.json +++ b/templates/csharp/notification-webapi/appsettings.TestTool.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file diff --git a/templates/csharp/notification-webapi/{{ProjectName}}.csproj.tpl b/templates/csharp/notification-webapi/{{ProjectName}}.csproj.tpl index fea7c25242..91924fe6a2 100644 --- a/templates/csharp/notification-webapi/{{ProjectName}}.csproj.tpl +++ b/templates/csharp/notification-webapi/{{ProjectName}}.csproj.tpl @@ -16,6 +16,7 @@ + diff --git a/templates/csharp/workflow/GettingStarted.md b/templates/csharp/workflow/GettingStarted.md.tpl similarity index 78% rename from templates/csharp/workflow/GettingStarted.md rename to templates/csharp/workflow/GettingStarted.md.tpl index bb9c48f271..a9910a0993 100644 --- a/templates/csharp/workflow/GettingStarted.md +++ b/templates/csharp/workflow/GettingStarted.md.tpl @@ -2,6 +2,11 @@ ## Quick Start +{{#enableTestToolByDefault}} +1. Press F5, or select the Debug > Start Debugging menu in Visual Studio +2. In Teams App Test Tool from the launched browser, type and send "helloWorld" to your app to trigger a response +{{/enableTestToolByDefault}} +{{^enableTestToolByDefault}} 1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel 2. Right-click your project and select Teams Toolkit > Prepare Teams app dependencies 3. If prompted, sign in with an M365 account for the Teams organization you want @@ -9,6 +14,7 @@ to install the app to 4. Press F5, or select the Debug > Start Debugging menu in Visual Studio 5. In the launched browser, select the Add button to load the app in Teams 6. In the chat bar, type and send "helloWorld" to your app to trigger a response +{{/enableTestToolByDefault}} ## Learn more diff --git a/templates/csharp/workflow/Properties/launchSettings.json.tpl b/templates/csharp/workflow/Properties/launchSettings.json.tpl index 59e957f91f..5339d2af26 100644 --- a/templates/csharp/workflow/Properties/launchSettings.json.tpl +++ b/templates/csharp/workflow/Properties/launchSettings.json.tpl @@ -10,7 +10,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, @@ -37,7 +38,8 @@ "launchUrl": "http://localhost:56150", "applicationUrl": "http://localhost:5130", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "TestTool" + "ASPNETCORE_ENVIRONMENT": "TestTool", + "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" }, "hotReloadProfile": "aspnetcore" }, diff --git a/templates/csharp/workflow/appsettings.TestTool.json b/templates/csharp/workflow/appsettings.TestTool.json index c041caeef4..1a3d21d69a 100644 --- a/templates/csharp/workflow/appsettings.TestTool.json +++ b/templates/csharp/workflow/appsettings.TestTool.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "BOT_ID": "", - "BOT_PASSWORD": "", - "TEAMSFX_NOTIFICATION_STORE_FILENAME": ".notification.testtoolstore.json" + "BOT_PASSWORD": "" } \ No newline at end of file