Skip to content

Commit

Permalink
Merge pull request #1065 from OfficeDev/v-harikrishnan/ImplementToolk…
Browse files Browse the repository at this point in the history
…itCsharpSample_1

PR 2 - Implement toolkit csharp samples
  • Loading branch information
Harikrishnan-MSFT authored Feb 19, 2024
2 parents 6dcc923 + 8de556a commit bd4823f
Show file tree
Hide file tree
Showing 47 changed files with 1,121 additions and 162 deletions.
25 changes: 25 additions & 0 deletions samples/tab-channel-group/razor-csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# TeamsFx files
build
AppManifest/build
env/.env.*.user
env/.env.local
appsettings.Development.json
.deployment

# User-specific files
*.user

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Notification local store
.notification.localstore.json
13 changes: 7 additions & 6 deletions samples/tab-channel-group/razor-csharp/AppManifest/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.16/MicrosoftTeams.schema.json",
"manifestVersion": "1.16",
"id": "<<Guid>>",
"id": "${{TEAMS_APP_ID}}",
"version": "1.0.0",
"packageName": "com.custom.tab",
"developer": {
"name": "Microsoft",
"websiteUrl": "https://www.microsoft.com",
"privacyUrl": "https://www.microsoft.com/privacy",
"termsOfUseUrl": "https://www.microsoft.com/termsofuse"
"websiteUrl": "https://${{TAB_DOMAIN}}",
"privacyUrl": "https://${{TAB_DOMAIN}}/privacy",
"termsOfUseUrl": "https://${{TAB_DOMAIN}}/termsofuse"
},
"name": {
"short": "Channel Group Tab",
Expand All @@ -25,7 +25,7 @@
"accentColor": "#D85028",
"configurableTabs": [
{
"configurationUrl": "https://<Base-url>/tab",
"configurationUrl": "https://${{TAB_DOMAIN}}/tab",
"canUpdateConfiguration": true,
"scopes": [
"groupchat",
Expand All @@ -38,6 +38,7 @@
"messageTeamMembers"
],
"validDomains": [
"{{domain-name}}"
"*.ngrok-free.app",
"${{TAB_DOMAIN}}"
]
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:3978",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ChannelGroupTab": {
// 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": "https://localhost:44302;http://localhost:2544",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:3979;http://localhost:3978"
"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:44302;http://localhost:2544",
// "environmentVariables": {
// "ASPNETCORE_ENVIRONMENT": "Development"
// },
// "hotReloadProfile": "aspnetcore"
//}
}
}
13 changes: 13 additions & 0 deletions samples/tab-channel-group/razor-csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ Please find below demo manifest which is deployed on Microsoft Azure and you can

- [Teams](https://teams.microsoft.com) Microsoft Teams is installed and you have an account

- [Teams Toolkit for Visual Studio](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)

## 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.8 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 Visual Studio, right-click your 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.
> If you do not have permission to upload custom apps (sideloading), Teams Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.

## Setup

1. Run ngrok - point to port 3978
Expand Down
4 changes: 4 additions & 0 deletions samples/tab-channel-group/razor-csharp/channelGroupTab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="TeamsFx" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions samples/tab-channel-group/razor-csharp/env/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment.

# Built-in environment variables
TEAMSFX_ENV=local

# Generated during provision, you can also add your own variables.
TEAMS_APP_ID=
TAB_ENDPOINT=

TEAMSFX_M365_USER_NAME=

APP_NAME_SUFFIX=
TAB_DOMAIN=
TEAMS_APP_TENANT_ID=
66 changes: 66 additions & 0 deletions samples/tab-channel-group/razor-csharp/teamsapp.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json
# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file
# Visit https://aka.ms/teamsfx-actions for details on actions
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:tab-channel-group-razor-csharp

provision:
# Set TAB_DOMAIN and TAB_ENDPOINT for local launch
- uses: script
with:
run:
echo "::set-teamsfx-env TAB_DOMAIN=localhost:44302";
echo "::set-teamsfx-env TAB_ENDPOINT=https://localhost:44302";

# Creates a Teams app
- uses: teamsApp/create
with:
# Teams app name
name: tab-channel-group-${{TEAMSFX_ENV}}
# Write the information of created resources into environment file for
# the specified environment variable(s).
writeToEnvironmentFile:
teamsAppId: TEAMS_APP_ID

# Validate using manifest schema
- uses: teamsApp/validateManifest
with:
# Path to manifest template
manifestPath: ./AppManifest/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
# 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
# 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: "https://localhost:44302;http://localhost:2544"
environmentVariables:
ASPNETCORE_ENVIRONMENT: "Development"
hotReloadProfile: "aspnetcore"
9 changes: 9 additions & 0 deletions samples/tab-channel-group/razor-csharp/teamsapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json
# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file
# Visit https://aka.ms/teamsfx-actions for details on actions
version: v1.2

additionalMetadata:
sampleTag: Microsoft-Teams-Samples:tab-channel-group-razor-csharp

environmentFolderPath: ./env
12 changes: 12 additions & 0 deletions samples/tab-conversations/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ Please find below demo manifest which is deployed on Microsoft Azure and you can
# determine dotnet version
dotnet --version
```
- [Teams Toolkit for Visual Studio](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/toolkit-v4/install-teams-toolkit-vs?pivots=visual-studio-v17-7)

## 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.8 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 Visual Studio, right-click your 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.
> If you do not have permission to upload custom apps (sideloading), Teams Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.

## Setup
1. Register a new application in the [Microsoft Entra ID – App Registrations](https://go.microsoft.com/fwlink/?linkid=2083908) portal.
Expand Down
25 changes: 25 additions & 0 deletions samples/tab-conversations/csharp/TabConversation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# TeamsFx files
build
AppManifest/build
env/.env.*.user
env/.env.local
appsettings.Development.json
.deployment

# User-specific files
*.user

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Notification local store
.notification.localstore.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.12/MicrosoftTeams.schema.json",
"manifestVersion": "1.12",
"version": "1.0.0",
"id": "b404cc0a-f062-42c5-85c8-d8bb1dd12fc1",
"id": "${{TEAMS_APP_ID}}",
"packageName": "com.microsoft.tabconversations",
"developer": {
"name": "Microsoft",
Expand All @@ -25,7 +25,7 @@
"accentColor": "#60A18E",
"configurableTabs": [
{
"configurationUrl": "<<your base url>>/configure",
"configurationUrl": "https://${{TAB_DOMAIN}}/configure",
"canUpdateConfiguration": true,
"scopes": [
"team"
Expand All @@ -37,6 +37,7 @@
],
"permissions": [ "identity", "messageTeamMembers" ],
"validDomains": [
"<<DOMAIN-NAME>>"
"*.ngrok-free.app",
"${{TAB_DOMAIN}}"
]
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:3978",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
}
},
"TabConversation": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
},
"applicationUrl": "http://localhost:5000"
}
}
"profiles": {
// Debug project within Teams
"Microsoft Teams (browser)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "https://teams.microsoft.com/l/app/294d0749-3209-4cfe-9f85-2d0c99684e8d?installAppPackage=true&webjoin=true&appTenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&login_hint=v-hrajandira@microsoft.com",
"applicationUrl": "https://localhost:44302;http://localhost:2544",
"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:44302;http://localhost:2544",
// "environmentVariables": {
// "ASPNETCORE_ENVIRONMENT": "Development"
// },
// "hotReloadProfile": "aspnetcore"
//}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.11" />
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="TeamsFx" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions samples/tab-conversations/csharp/TabConversation/env/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment.

# Built-in environment variables
TEAMSFX_ENV=local

# Generated during provision, you can also add your own variables.
TEAMS_APP_ID=
TAB_ENDPOINT=

APP_NAME_SUFFIX=
TAB_DOMAIN=
TEAMS_APP_TENANT_ID=
TEAMSFX_M365_USER_NAME=
Loading

0 comments on commit bd4823f

Please sign in to comment.