Skip to content

Commit 105b308

Browse files
authored
[#591] Update dotnet projects to target NET 6 (#593)
* Update Test projects from netcoreapp3.1 to net6.0 * Update Bots from netcoreapp3.1 to net6.0 * Fix Analyzers error StringComparison.Ordinal * Fix Analyzers error SYSLIB0014 * Update pipelines to support net6.0 * Update documentation * Update yarn-berry to 3.2.3
1 parent 44f8f28 commit 105b308

File tree

32 files changed

+15977
-17264
lines changed

32 files changed

+15977
-17264
lines changed

Bots/DotNet/ComposerHostBotDotNet/ComposerHostBotDotNet.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
66
<UserSecretsId>4c5f0a9c-7432-4136-8191-185b11f6f2c0</UserSecretsId>
77
</PropertyGroup>

Bots/DotNet/ComposerSkillBotDotNet/Microsoft.Bot.Builder.FunctionalTestsBots.ComposerSkillBotDotNet.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
66
<UserSecretsId>9cc9c906-a26d-4418-8427-890645f1e974</UserSecretsId>
77
</PropertyGroup>

Bots/DotNet/EchoSkillBot/Microsoft.Bot.Builder.FunctionalTestsBots.EchoSkillBot.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<AssemblyName>Microsoft.BotFrameworkFunctionalTests.EchoSkillBot</AssemblyName>
77
<RootNamespace>Microsoft.BotFrameworkFunctionalTests.EchoSkillBot</RootNamespace>

Bots/DotNet/EchoSkillBot/wwwroot/manifests/echoskillbot-manifest-1.0.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"$id": "EchoSkillBotDotNet",
44
"name": "EchoSkillBotDotNet",
55
"version": "1.0",
6-
"description": "This is a skill for echoing what the user sent to the bot (using .netcore 3.1).",
6+
"description": "This is a skill for echoing what the user sent to the bot (using .netcore 6.0).",
77
"publisherName": "Microsoft",
88
"privacyUrl": "https://microsoft.com/privacy",
99
"copyright": "Copyright (c) Microsoft Corporation. All rights reserved.",

Bots/DotNet/EchoSkillBotComposer/Microsoft.Bot.Builder.FunctionalTestsBots.EchoSkillBotComposer.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
66
<UserSecretsId>720cb418-9c27-47a3-b473-1b8771598297</UserSecretsId>
77
</PropertyGroup>

Bots/DotNet/SimpleHostBot/Microsoft.Bot.Builder.FunctionalTestsBots.SimpleHostBot.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<AssemblyName>Microsoft.BotFrameworkFunctionalTests.SimpleHostBot</AssemblyName>
77
<RootNamespace>Microsoft.BotFrameworkFunctionalTests.SimpleHostBot</RootNamespace>

Bots/DotNet/SimpleHostBotComposer/Microsoft.Bot.Builder.FunctionalTestsBots.SimpleHostBotComposer.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
66
<UserSecretsId>c7eabc4e-9c9c-4b56-82d5-23e24f20ee24</UserSecretsId>
77
</PropertyGroup>

Bots/DotNet/WaterfallHostBot/Dialogs/MainDialog.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected override async Task<DialogTurnResult> OnContinueDialogAsync(DialogCont
103103
// This is an example on how to cancel a SkillDialog that is currently in progress from the parent bot.
104104
var activeSkill = await _activeSkillProperty.GetAsync(innerDc.Context, () => null, cancellationToken);
105105
var activity = innerDc.Context.Activity;
106-
if (activeSkill != null && activity.Type == ActivityTypes.Message && !string.IsNullOrWhiteSpace(activity.Text) && activity.Text.Equals("abort", StringComparison.CurrentCultureIgnoreCase))
106+
if (activeSkill != null && activity.Type == ActivityTypes.Message && !string.IsNullOrWhiteSpace(activity.Text) && activity.Text.Equals("abort", StringComparison.OrdinalIgnoreCase))
107107
{
108108
// Cancel all dialogs when the user says abort.
109109
// The SkillDialog automatically sends an EndOfConversation message to the skill to let the
@@ -113,7 +113,7 @@ protected override async Task<DialogTurnResult> OnContinueDialogAsync(DialogCont
113113
}
114114

115115
// Sample to test a tangent when in the middle of a skill conversation.
116-
if (activeSkill != null && activity.Type == ActivityTypes.Message && !string.IsNullOrWhiteSpace(activity.Text) && activity.Text.Equals("tangent", StringComparison.CurrentCultureIgnoreCase))
116+
if (activeSkill != null && activity.Type == ActivityTypes.Message && !string.IsNullOrWhiteSpace(activity.Text) && activity.Text.Equals("tangent", StringComparison.OrdinalIgnoreCase))
117117
{
118118
// Start tangent.
119119
return await innerDc.BeginDialogAsync(nameof(TangentDialog), cancellationToken: cancellationToken);

Bots/DotNet/WaterfallHostBot/Microsoft.Bot.Builder.FunctionalTestsBots.WaterfallHostBot.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<AssemblyName>Microsoft.BotFrameworkFunctionalTests.WaterfallHostBot</AssemblyName>
77
<RootNamespace>Microsoft.BotFrameworkFunctionalTests.WaterfallHostBot</RootNamespace>

Bots/DotNet/WaterfallHostBot/TokenExchangeSkillHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private BotFrameworkSkill GetCallingSkill(ClaimsIdentity claimsIdentity)
8383
return null;
8484
}
8585

86-
return _skillsConfig.Skills.Values.FirstOrDefault(s => string.Equals(s.AppId, appId, StringComparison.InvariantCultureIgnoreCase));
86+
return _skillsConfig.Skills.Values.FirstOrDefault(s => string.Equals(s.AppId, appId, StringComparison.OrdinalIgnoreCase));
8787
}
8888

8989
private async Task<bool> InterceptOAuthCards(ClaimsIdentity claimsIdentity, Activity activity, CancellationToken cancellationToken)

Bots/DotNet/WaterfallSkillBot/Dialogs/FileUpload/FileUploadDialog.cs

+14-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.IO;
55
using System.Net;
6+
using System.Net.Http;
67
using System.Threading;
78
using System.Threading.Tasks;
89
using Microsoft.Bot.Builder.Dialogs;
@@ -35,21 +36,24 @@ private async Task<DialogTurnResult> PromptUploadStepAsync(WaterfallStepContext
3536

3637
private async Task<DialogTurnResult> HandleAttachmentStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
3738
{
38-
var fileText = string.Empty;
39+
var fileText = string.Empty;
40+
using var client = new HttpClient();
3941

4042
foreach (var file in stepContext.Context.Activity.Attachments)
4143
{
4244
var remoteFileUrl = file.ContentUrl;
4345
var localFileName = Path.Combine(Path.GetTempPath(), file.Name);
44-
string fileContent;
45-
46-
using (var webClient = new WebClient())
47-
{
48-
webClient.DownloadFile(remoteFileUrl, localFileName);
49-
using var reader = new StreamReader(localFileName);
50-
fileContent = await reader.ReadToEndAsync();
51-
}
52-
46+
string fileContent;
47+
48+
using var stream = await client.GetStreamAsync(remoteFileUrl, cancellationToken);
49+
using (var fs = new FileStream(localFileName, FileMode.Create))
50+
{
51+
await stream.CopyToAsync(fs, cancellationToken);
52+
}
53+
54+
using var reader = new StreamReader(localFileName);
55+
fileContent = await reader.ReadToEndAsync();
56+
5357
fileText += $"Attachment \"{file.Name}\" has been received.\r\n";
5458
fileText += $"File content: {fileContent}\r\n";
5559
}

Bots/DotNet/WaterfallSkillBot/Microsoft.Bot.Builder.FunctionalTestsBots.WaterfallSkillBot.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<AssemblyName>Microsoft.BotFrameworkFunctionalTests.WaterfallSkillBot</AssemblyName>
77
<RootNamespace>Microsoft.BotFrameworkFunctionalTests.WaterfallSkillBot</RootNamespace>

0 commit comments

Comments
 (0)