Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR 4 - Implement New toolkit version csharp samples #1250

Merged
merged 11 commits into from
May 30, 2024
Merged
11 changes: 11 additions & 0 deletions samples/bot-adaptive-card-actions/csharp/AdaptiveCardActions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdaptiveCardActions", "AdaptiveCardActions\AdaptiveCardActions.csproj", "{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}"
EndProject
Project("{A9E3F50B-275E-4AF7-ADCE-8BE12D41E305}") = "TeamsApp", "TeamsApp\TeamsApp.ttkproj", "{BD0063E4-061D-459C-A143-9805F2A64B99}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6794E91B-8779-453A-8802-7CD6A1B3A07A}"
ProjectSection(SolutionItems) = preProject
AdaptiveCardActions.slnLaunch.user = AdaptiveCardActions.slnLaunch.user
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +22,10 @@ Global
{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}.Release|Any CPU.Build.0 = Release|Any CPU
{BD0063E4-061D-459C-A143-9805F2A64B99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD0063E4-061D-459C-A143-9805F2A64B99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD0063E4-061D-459C-A143-9805F2A64B99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD0063E4-061D-459C-A143-9805F2A64B99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"Name": "Microsoft Teams (browser)",
"Projects": [
{
"Path": "AdaptiveCardActions\\AdaptiveCardActions.csproj",
"Action": "Start",
"DebugTarget": "Start Project"
},
{
"Path": "TeamsApp\\TeamsApp.ttkproj",
"Action": "StartWithoutDebugging",
"DebugTarget": "Microsoft Teams (browser)"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TeamsFx files
build
AppManifest/build
appPackage/build
env/.env.*.user
env/.env.local
appsettings.Development.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
{
"profiles": {
// Debug project within Teams
"Microsoft Teams (browser)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "https://teams.microsoft.com/l/app/%TEAMSAPPID%?installAppPackage=true&webjoin=true&appTenantId=%TENANTID%&login_hint=%USERNAME%",
"applicationUrl": "http://localhost:5130",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"hotReloadProfile": "aspnetcore"
"Start Project": {
"commandName": "Project",
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7130;http://localhost:5130",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"hotReloadProfile": "aspnetcore"
}
//// Uncomment following profile to debug project only (without launching Teams)
//,
//"Start Project (not in Teams)": {
// "commandName": "Project",
// "dotnetRunMessages": true,
// "launchBrowser": true,
// "applicationUrl": "https://localhost:7130;http://localhost:5130",
// "environmentVariables": {
// "ASPNETCORE_ENVIRONMENT": "Development"
// },
// "hotReloadProfile": "aspnetcore"
//}
}
}
11 changes: 6 additions & 5 deletions samples/bot-adaptive-card-actions/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ Please find below demo manifest which is deployed on Microsoft Azure and you can
## Run the app (Using Teams Toolkit for Visual Studio)

The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio.
1. Install Visual Studio 2022 **Version 17.9 Preview 2 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Visual Studio 2022 **Version 17.10 Preview 4 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Teams Toolkit for Visual Studio [Teams Toolkit extension](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)
1. In the debug dropdown menu of Visual Studio, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel.
1. In Visual Studio, right-click your project and **Select Teams Toolkit > Prepare Teams App Dependencies**
1. In the debug dropdown menu of Visual Studio, select default startup project > **Microsoft Teams (browser)**
1. In Visual Studio, right-click your **TeamsApp** project and **Select Teams Toolkit > Prepare Teams App Dependencies**
1. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps.
1. Select **Debug > Start Debugging** or **F5** to run the menu in Visual Studio.
1. In the browser that launches, select the **Add** button to install the app to Teams.
Expand Down Expand Up @@ -94,14 +95,14 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual

4. Setup Manifest for Teams
- __*This step is specific to Teams.*__
- **Edit** the `manifest.json` contained in the ./AppManifest folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) *everywhere* you see the place holder string `{{Microsoft-App-Id}}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Edit** the `manifest.json` contained in the ./appPackage folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) *everywhere* you see the place holder string `{{Microsoft-App-Id}}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Edit** the `manifest.json` for `validDomains` and replace `{{Domain-Name}}` with base Url of your domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`.
- **Zip** up the contents of the `AppManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- **Zip** up the contents of the `appPackage` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)

- Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")
- Go to Microsoft Teams. From the lower left corner, select Apps
- From the lower left corner, choose Upload a custom App
- Go to your project directory, the ./AppManifest folder, select the zip folder, and choose Open.
- Go to your project directory, the ./appPackage folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.

**Note**: If you are facing any issue in your app, please uncomment [this](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-adaptive-card-actions/csharp/AdaptiveCardActions/AdapterWithErrorHandler.cs#L28) line and put your debugger for local debug.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.TeamsFx.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>bd0063e4-061d-459c-a143-9805f2a64b99</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<ProjectCapability Include="ProjectConfigurationsDeclaredDimensions" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ MICROSOFT_APP_TENANT_ID=
TEAMSFX_M365_USER_NAME=

BOT_ENDPOINT=
BOT_DOMAIN=
BOT_DOMAIN=

AZURE_SUBSCRIPTION_ID=
AZURE_RESOURCE_GROUP_NAME=
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"profiles": {
// Debug project within Teams
"Microsoft Teams (browser)": {
"commandName": "Project",
"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}}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ provision:
# Generate runtime appsettings to JSON file
- uses: file/createOrUpdateJsonFile
with:
target: ./appsettings.json
target: ../AdaptiveCardActions/appsettings.json
content:
MicrosoftAppId: ${{AAD_APP_CLIENT_ID}}
MicrosoftAppPassword: ${{SECRET_AAD_APP_CLIENT_SECRET}}
Expand All @@ -59,41 +59,25 @@ provision:
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./AppManifest/manifest.json
manifestPath: ./appPackage/manifest.json

# Build Teams app package with latest env value
- uses: teamsApp/zipAppPackage
with:
# Path to manifest template
manifestPath: ./AppManifest/manifest.json
outputZipPath: ./AppManifest/build/AppManifest.${{TEAMSFX_ENV}}.zip
outputJsonPath: ./AppManifest/build/manifest.${{TEAMSFX_ENV}}.json
manifestPath: ./appPackage/manifest.json
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
outputJsonPath: ./appPackage/build/manifest.${{TEAMSFX_ENV}}.json
# Validate app package using validation rules
- uses: teamsApp/validateAppPackage
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./AppManifest/build/AppManifest.${{TEAMSFX_ENV}}.zip
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip

# Apply the Teams app manifest to an existing Teams app in
# Teams Developer Portal.
# Will use the app id in manifest file to determine which Teams app to update.
- uses: teamsApp/update
with:
# Relative path to this file. This is the path for built zip file.
appPackagePath: ./AppManifest/build/AppManifest.${{TEAMSFX_ENV}}.zip

# Create or update debug profile in lauchsettings file
- uses: file/createOrUpdateJsonFile
with:
target: ./Properties/launchSettings.json
content:
profiles:
Microsoft Teams (browser):
commandName: "Project"
dotnetRunMessages: true
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}}"
applicationUrl: "http://localhost:5130"
environmentVariables:
ASPNETCORE_ENVIRONMENT: "Development"
hotReloadProfile: "aspnetcore"
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
15 changes: 13 additions & 2 deletions samples/bot-daily-task-reminder/csharp/BotDailyTaskReminder.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31410.357
# Visual Studio Version 17
VisualStudioVersion = 17.10.34814.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotDailyTaskReminder", "BotDailyTaskReminder\BotDailyTaskReminder.csproj", "{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}"
EndProject
Project("{A9E3F50B-275E-4AF7-ADCE-8BE12D41E305}") = "TeamsApp", "TeamsApp\TeamsApp.ttkproj", "{01E9AC3F-43C7-46DA-89BB-7E70F4B08B5C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9268A822-4DDA-4A0B-A2EB-E3551E6CE680}"
ProjectSection(SolutionItems) = preProject
BotDailyTaskReminder.slnLaunch.user = BotDailyTaskReminder.slnLaunch.user
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +22,10 @@ Global
{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFDF6B3D-BB62-42DD-88EF-528FFE9FCBAD}.Release|Any CPU.Build.0 = Release|Any CPU
{01E9AC3F-43C7-46DA-89BB-7E70F4B08B5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01E9AC3F-43C7-46DA-89BB-7E70F4B08B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01E9AC3F-43C7-46DA-89BB-7E70F4B08B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01E9AC3F-43C7-46DA-89BB-7E70F4B08B5C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"Name": "Microsoft Teams (browser)",
"Projects": [
{
"Path": "BotDailyTaskReminder\\BotDailyTaskReminder.csproj",
"Action": "Start",
"DebugTarget": "Start Project"
},
{
"Path": "TeamsApp\\TeamsApp.ttkproj",
"Action": "StartWithoutDebugging",
"DebugTarget": "Microsoft Teams (browser)"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TeamsFx files
build
AppManifest/build
appPackage/build
env/.env.*.user
env/.env.local
appsettings.Development.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
{
"profiles": {
// Debug project within Teams
"Microsoft Teams (browser)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "https://teams.microsoft.com/l/app/%TEAMSAPPID%?installAppPackage=true&webjoin=true&appTenantId=%TENANTID%&login_hint=%USERNAME%",
"applicationUrl": "http://localhost:5130",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"hotReloadProfile": "aspnetcore"
"Start Project": {
"commandName": "Project",
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7130;http://localhost:5130",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"hotReloadProfile": "aspnetcore"
}
//// Uncomment following profile to debug project only (without launching Teams)
//,
//"Start Project (not in Teams)": {
// "commandName": "Project",
// "dotnetRunMessages": true,
// "launchBrowser": true,
// "applicationUrl": "https://localhost:7130;http://localhost:5130",
// "environmentVariables": {
// "ASPNETCORE_ENVIRONMENT": "Development"
// },
// "hotReloadProfile": "aspnetcore"
//}
}
}
11 changes: 6 additions & 5 deletions samples/bot-daily-task-reminder/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ Please find below demo manifest which is deployed on Microsoft Azure and you can
## Run the app (Using Teams Toolkit for Visual Studio)

The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio.
1. Install Visual Studio 2022 **Version 17.9 Preview 2 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Visual Studio 2022 **Version 17.10 Preview 4 or higher** [Visual Studio](https://visualstudio.microsoft.com/downloads/)
1. Install Teams Toolkit for Visual Studio [Teams Toolkit extension](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)
1. In the debug dropdown menu of Visual Studio, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel.
1. In Visual Studio, right-click your project and **Select Teams Toolkit > Prepare Teams App Dependencies**
1. In the debug dropdown menu of Visual Studio, select default startup project > **Microsoft Teams (browser)**
1. In Visual Studio, right-click your **TeamsApp** project and **Select Teams Toolkit > Prepare Teams App Dependencies**
1. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps.
1. Select **Debug > Start Debugging** or **F5** to run the menu in Visual Studio.
1. In the browser that launches, select the **Add** button to install the app to Teams.
Expand Down Expand Up @@ -96,14 +97,14 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual

5. Setup Manifest for Teams
- __*This step is specific to Teams.*__
- **Edit** the `manifest.json` contained in the ./AppManifest folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) *everywhere* you see the place holder string `{{Microsoft-App-Id}}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Edit** the `manifest.json` contained in the ./appPackage folder to replace your Microsoft App Id (that was created when you registered your app registration earlier) *everywhere* you see the place holder string `{{Microsoft-App-Id}}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Edit** the `manifest.json` for `validDomains` and replace `{{domain-name}}` with base Url of your domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`.
- **Zip** up the contents of the `AppManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- **Zip** up the contents of the `appPackage` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)

- Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")
- Go to Microsoft Teams. From the lower left corner, select Apps
- From the lower left corner, choose Upload a custom App
- Go to your project directory, the ./AppManifest folder, select the zip folder, and choose Open.
- Go to your project directory, the ./appPackage folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.

**Note**: If you are facing any issue in your app, please uncomment [this](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-daily-task-reminder/csharp/BotDailyTaskReminder/AdapterWithErrorHandler.cs#L30) line and put your debugger for local debug.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.TeamsFx.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>01e9ac3f-43c7-46da-89bb-7e70f4b08b5c</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<ProjectCapability Include="ProjectConfigurationsDeclaredDimensions" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ MICROSOFT_APP_TENANT_ID=
TEAMSFX_M365_USER_NAME=

BOT_ENDPOINT=
BOT_DOMAIN=
BOT_DOMAIN=

AZURE_SUBSCRIPTION_ID=
AZURE_RESOURCE_GROUP_NAME=
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"profiles": {
// Debug project within Teams
"Microsoft Teams (browser)": {
"commandName": "Project",
"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}}"
}
}
}