diff --git a/samples/core-DirectLine/DirectLineBot/DirectLineBot.csproj b/samples/core-DirectLine/DirectLineBot/DirectLineBot.csproj index b0e2e5b..d9ca268 100644 --- a/samples/core-DirectLine/DirectLineBot/DirectLineBot.csproj +++ b/samples/core-DirectLine/DirectLineBot/DirectLineBot.csproj @@ -1,13 +1,13 @@  - netcoreapp2.1 + netcoreapp3.1 latest - - + + diff --git a/samples/core-DirectLine/DirectLineBot/Startup.cs b/samples/core-DirectLine/DirectLineBot/Startup.cs index b107c3a..4ae4b90 100644 --- a/samples/core-DirectLine/DirectLineBot/Startup.cs +++ b/samples/core-DirectLine/DirectLineBot/Startup.cs @@ -27,7 +27,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); @@ -43,16 +43,16 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDeveloperExceptionPage(); } - else - { - app.UseHsts(); - } - app.UseDefaultFiles(); - app.UseStaticFiles(); - app.UseWebSockets(); + app.UseDefaultFiles() + .UseStaticFiles() + .UseRouting() + .UseAuthorization() + .UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); //app.UseHttpsRedirection(); - app.UseMvc(); } } } diff --git a/samples/core-DirectLine/DirectLineClient/App.config b/samples/core-DirectLine/DirectLineClient/App.config deleted file mode 100644 index 7470cb7..0000000 --- a/samples/core-DirectLine/DirectLineClient/App.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/core-DirectLine/DirectLineClient/DirectLineSampleClient.csproj b/samples/core-DirectLine/DirectLineClient/DirectLineSampleClient.csproj index 2c5290f..e88d222 100644 --- a/samples/core-DirectLine/DirectLineClient/DirectLineSampleClient.csproj +++ b/samples/core-DirectLine/DirectLineClient/DirectLineSampleClient.csproj @@ -1,77 +1,29 @@ - - - + + - Debug - AnyCPU - {10935995-5C58-438B-B5F0-FA94BEA2667F} - Exe - Properties - DirectLineSampleClient - DirectLineSampleClient - v4.6.1 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + netcoreapp3.1 + 8.0 + 0.9.0 + Exe + - - ..\packages\Microsoft.Bot.Connector.DirectLine.3.0.1\lib\net45\Microsoft.Bot.Connector.DirectLine.dll - - - ..\packages\Microsoft.Rest.ClientRuntime.2.3.4\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - + + + + + + - - - + + - - + + PreserveNewest + - - - \ No newline at end of file + + + diff --git a/samples/core-DirectLine/DirectLineClient/Program.cs b/samples/core-DirectLine/DirectLineClient/Program.cs index f8bd79a..7c4c667 100644 --- a/samples/core-DirectLine/DirectLineClient/Program.cs +++ b/samples/core-DirectLine/DirectLineClient/Program.cs @@ -2,21 +2,27 @@ { using System; using System.Configuration; - using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.Bot.Connector.DirectLine; using Models; using Newtonsoft.Json; + using Microsoft.Extensions.Configuration; public class Program { - private static string directLineSecret = ConfigurationManager.AppSettings["DirectLineSecret"]; - private static string botId = ConfigurationManager.AppSettings["BotId"]; + private static string directLineSecret; + private static string botId; private static string fromUser = "DirectLineSampleClientUser"; public static void Main(string[] args) { + IConfiguration configuration = new ConfigurationBuilder() + .AddJsonFile("appsettings.json", true, true) + .Build(); + + directLineSecret = configuration.GetValue("DirectLineSecret"); + botId= configuration.GetValue("BotId"); StartBotConversation().Wait(); } @@ -85,7 +91,7 @@ private static async Task ReadBotMessagesAsync(DirectLineClient client, string c case "image/png": Console.WriteLine($"Opening the requested image '{attachment.ContentUrl}'"); - Process.Start(attachment.ContentUrl); + System.Diagnostics.Process.Start(attachment.ContentUrl); break; } } diff --git a/samples/core-DirectLine/DirectLineClient/Properties/AssemblyInfo.cs b/samples/core-DirectLine/DirectLineClient/Properties/AssemblyInfo.cs deleted file mode 100644 index 41b3efe..0000000 --- a/samples/core-DirectLine/DirectLineClient/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("DirectLineSampleClient")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DirectLineSampleClient")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("10935995-5c58-438b-b5f0-fa94bea2667f")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/core-DirectLine/DirectLineClient/appsettings.json b/samples/core-DirectLine/DirectLineClient/appsettings.json new file mode 100644 index 0000000..cb73f36 --- /dev/null +++ b/samples/core-DirectLine/DirectLineClient/appsettings.json @@ -0,0 +1,4 @@ +{ + "BotId": "", + "DirectLineSecret": "" +} \ No newline at end of file diff --git a/samples/core-DirectLine/DirectLineClient/packages.config b/samples/core-DirectLine/DirectLineClient/packages.config deleted file mode 100644 index b0c2187..0000000 --- a/samples/core-DirectLine/DirectLineClient/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/samples/core-DirectLine/README.md b/samples/core-DirectLine/README.md index a8411a6..308bb0d 100644 --- a/samples/core-DirectLine/README.md +++ b/samples/core-DirectLine/README.md @@ -5,7 +5,7 @@ A sample bot and a custom client communicating to each other using the Direct Li ### Prerequisites The minimum prerequisites to run this sample are: -* The latest update of Visual Studio 2017. You can download the community version [here](http://www.visualstudio.com) for free. +* The latest update of Visual Studio 2019. You can download the community version [here](http://www.visualstudio.com) for free. * The Bot Framework Emulator. To install the Bot Framework Emulator, download it from [here](https://emulator.botframework.com/). Please refer to [this documentation article](https://github.com/microsoft/botframework-emulator/wiki/Getting-Started) to know more about the Bot Framework Emulator. * Register your bot with the Microsoft Bot Framework. Please refer to [this](https://docs.microsoft.com/en-us/bot-framework/portal-register-bot) for the instructions. Once you complete the registration, update the [Bot's appsettings.json](DirectLineBot/appsettings.json) file with the registered config values (MicrosoftAppId and MicrosoftAppPassword) diff --git a/samples/core-DirectLineWebSockets/DirectLineBot/DirectLineBot.csproj b/samples/core-DirectLineWebSockets/DirectLineBot/DirectLineBot.csproj index c3ba921..a6b2da4 100644 --- a/samples/core-DirectLineWebSockets/DirectLineBot/DirectLineBot.csproj +++ b/samples/core-DirectLineWebSockets/DirectLineBot/DirectLineBot.csproj @@ -1,19 +1,20 @@  - netcoreapp2.1 + netcoreapp3.1 latest - - + + - + Always + diff --git a/samples/core-DirectLineWebSockets/DirectLineBot/Startup.cs b/samples/core-DirectLineWebSockets/DirectLineBot/Startup.cs index b107c3a..4ae4b90 100644 --- a/samples/core-DirectLineWebSockets/DirectLineBot/Startup.cs +++ b/samples/core-DirectLineWebSockets/DirectLineBot/Startup.cs @@ -27,7 +27,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); @@ -43,16 +43,16 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDeveloperExceptionPage(); } - else - { - app.UseHsts(); - } - app.UseDefaultFiles(); - app.UseStaticFiles(); - app.UseWebSockets(); + app.UseDefaultFiles() + .UseStaticFiles() + .UseRouting() + .UseAuthorization() + .UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); //app.UseHttpsRedirection(); - app.UseMvc(); } } }