From f42cdf7d4514ae571be22b5da58bbd983e649dea Mon Sep 17 00:00:00 2001 From: Klaus Comelli Date: Fri, 26 Jan 2018 11:51:03 +0100 Subject: [PATCH 1/3] Changed AlexaSkillsKit.Lib csproj to support multi-platform targeting of .Net 4.5, .Net Standard 1.1 and .Net Standard 2.0. Cloned AlexaSkillsKit.SampleCore to a corresponding version for .Net Core 2.0. Added simple powershell and batch file to create a multi-platform nuget package. --- AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj | 35 ++++++++++++--- .../AlexaSkillsKit.SampleCore.csproj | 3 ++ AlexaSkillsKit.SampleCore/README.TXT | 4 ++ .../AlexaSkillsKit.SampleCore2.csproj | 20 +++++++++ .../Controllers/ValuesController.cs | 44 +++++++++++++++++++ AlexaSkillsKit.SampleCore2/Program.cs | 27 ++++++++++++ .../Properties/launchSettings.json | 27 ++++++++++++ AlexaSkillsKit.SampleCore2/README.TXT | 4 ++ AlexaSkillsKit.SampleCore2/Startup.cs | 44 +++++++++++++++++++ .../appsettings.Development.json | 10 +++++ AlexaSkillsKit.SampleCore2/appsettings.json | 8 ++++ AlexaSkillsKit.sln | 30 +++++++++---- createPackages.cmd | 2 + createPackages.ps1 | 8 ++++ 14 files changed, 251 insertions(+), 15 deletions(-) create mode 100644 AlexaSkillsKit.SampleCore/README.TXT create mode 100644 AlexaSkillsKit.SampleCore2/AlexaSkillsKit.SampleCore2.csproj create mode 100644 AlexaSkillsKit.SampleCore2/Controllers/ValuesController.cs create mode 100644 AlexaSkillsKit.SampleCore2/Program.cs create mode 100644 AlexaSkillsKit.SampleCore2/Properties/launchSettings.json create mode 100644 AlexaSkillsKit.SampleCore2/README.TXT create mode 100644 AlexaSkillsKit.SampleCore2/Startup.cs create mode 100644 AlexaSkillsKit.SampleCore2/appsettings.Development.json create mode 100644 AlexaSkillsKit.SampleCore2/appsettings.json create mode 100644 createPackages.cmd create mode 100644 createPackages.ps1 diff --git a/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj b/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj index 167bb9d..7038c74 100755 --- a/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj +++ b/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj @@ -1,14 +1,14 @@  - netstandard1.1 - 1.6.0 + netstandard2.0;netstandard1.1;net45 + 1.7.0 Stefan Negritoiu (FreeBusy) Stefan Negritoiu (FreeBusy) AlexaSkillsKit AlexaSkillsKit.Net AlexaSkillsKit.Net - 1.5.0 - 1.5.0 + 1.7.0 + 1.7.0 .NET library that simplifies Alexa skills development; same object model as Amazon's AlexaSkillsKit for Java @@ -22,13 +22,34 @@ 1.4.0: Ability to override request validation policy and support for SSML output speech type 1.5.0: Fully implement certificate verification requirement and support for Standard cards 1.5.1: bug fix in certificate verification -1.6.0: migration to netstandard1.1 (supports .net 4.5+ and .net core 1.0+) +1.7.0: migration to netstandard1.1 (supports .net 4.5+, .net core 1.x and .net core 2.x) + + $(DefineConstants);NETCORE;NETSTD11 + 1.6.1 + $(AssetTargetFallback);dnxcore50 + + + $(DefineConstants);NETCORE;NETSTD20 + 2.0.0 + $(AssetTargetFallback);dnxcore50 + + + NET45 + + + + + + - - + + + + + \ No newline at end of file diff --git a/AlexaSkillsKit.SampleCore/AlexaSkillsKit.SampleCore.csproj b/AlexaSkillsKit.SampleCore/AlexaSkillsKit.SampleCore.csproj index ac29219..eb9422d 100755 --- a/AlexaSkillsKit.SampleCore/AlexaSkillsKit.SampleCore.csproj +++ b/AlexaSkillsKit.SampleCore/AlexaSkillsKit.SampleCore.csproj @@ -13,4 +13,7 @@ + + + \ No newline at end of file diff --git a/AlexaSkillsKit.SampleCore/README.TXT b/AlexaSkillsKit.SampleCore/README.TXT new file mode 100644 index 0000000..37aec3d --- /dev/null +++ b/AlexaSkillsKit.SampleCore/README.TXT @@ -0,0 +1,4 @@ + +# +# Sample .Net Core 1.1 WebAPI Project +# diff --git a/AlexaSkillsKit.SampleCore2/AlexaSkillsKit.SampleCore2.csproj b/AlexaSkillsKit.SampleCore2/AlexaSkillsKit.SampleCore2.csproj new file mode 100644 index 0000000..17c8abf --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/AlexaSkillsKit.SampleCore2.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.0 + + + + + + + + + + + + + + + + diff --git a/AlexaSkillsKit.SampleCore2/Controllers/ValuesController.cs b/AlexaSkillsKit.SampleCore2/Controllers/ValuesController.cs new file mode 100644 index 0000000..c0e2d6d --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/Controllers/ValuesController.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AlexaSkillsKit.SampleCore2.Controllers +{ + [Route("api/[controller]")] + public class ValuesController : Controller + { + // GET api/values + [HttpGet] + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/values/5 + [HttpGet("{id}")] + public string Get(int id) + { + return "value"; + } + + // POST api/values + [HttpPost] + public void Post([FromBody]string value) + { + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + } +} diff --git a/AlexaSkillsKit.SampleCore2/Program.cs b/AlexaSkillsKit.SampleCore2/Program.cs new file mode 100644 index 0000000..4acd903 --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace AlexaSkillsKit.SampleCore2 +{ + public class Program + { + public static void Main(string[] args) + { + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseKestrel() + .UseIISIntegration() + .UseStartup() + .Build(); + } +} diff --git a/AlexaSkillsKit.SampleCore2/Properties/launchSettings.json b/AlexaSkillsKit.SampleCore2/Properties/launchSettings.json new file mode 100644 index 0000000..ed6683c --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55038/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "AlexaSkillsKit.SampleCore2": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:55039/" + } + } +} diff --git a/AlexaSkillsKit.SampleCore2/README.TXT b/AlexaSkillsKit.SampleCore2/README.TXT new file mode 100644 index 0000000..9382780 --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/README.TXT @@ -0,0 +1,4 @@ + +# +# Sample .Net Core 2.0 WebAPI Project +# diff --git a/AlexaSkillsKit.SampleCore2/Startup.cs b/AlexaSkillsKit.SampleCore2/Startup.cs new file mode 100644 index 0000000..c519da0 --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/Startup.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace AlexaSkillsKit.SampleCore2 +{ + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc().AddWebApiConventions(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(Configuration.GetSection("Logging")); + loggerFactory.AddDebug(); + + app.UseMvc(); + } + } +} diff --git a/AlexaSkillsKit.SampleCore2/appsettings.Development.json b/AlexaSkillsKit.SampleCore2/appsettings.Development.json new file mode 100644 index 0000000..fa8ce71 --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/AlexaSkillsKit.SampleCore2/appsettings.json b/AlexaSkillsKit.SampleCore2/appsettings.json new file mode 100644 index 0000000..5fff67b --- /dev/null +++ b/AlexaSkillsKit.SampleCore2/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } + } +} diff --git a/AlexaSkillsKit.sln b/AlexaSkillsKit.sln index 3d68899..356a9b8 100644 --- a/AlexaSkillsKit.sln +++ b/AlexaSkillsKit.sln @@ -1,20 +1,23 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2010 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlexaSkillsKit.Lib", "AlexaSkillsKit.Lib\AlexaSkillsKit.Lib.csproj", "{0EC882A8-AACA-4BD5-B449-72F20FDB8586}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlexaSkillsKit.Lib", "AlexaSkillsKit.Lib\AlexaSkillsKit.Lib.csproj", "{0EC882A8-AACA-4BD5-B449-72F20FDB8586}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlexaSkillsKit.Sample", "AlexaSkillsKit.Sample\AlexaSkillsKit.Sample.csproj", "{9FDEF793-5832-4D37-B0D5-62C55AB1C12E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D35AD75F-7926-41CB-8C8D-BB36370F3E76}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlexaSkillsKit.Tests", "AlexaSkillsKit.Tests\AlexaSkillsKit.Tests.csproj", "{D0125A95-FD63-4A33-9220-206D4A1A14F0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packaging", "Packaging", "{0F14DFB6-D386-42C5-AF2A-6E33E4742F2F}" ProjectSection(SolutionItems) = preProject - .nuget\AlexaSkillsKit.Lib.nuspec = .nuget\AlexaSkillsKit.Lib.nuspec - .nuget\NuGet.Config = .nuget\NuGet.Config - .nuget\NuGet.targets = .nuget\NuGet.targets + createPackages.cmd = createPackages.cmd + createPackages.ps1 = createPackages.ps1 EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlexaSkillsKit.Tests", "AlexaSkillsKit.Tests\AlexaSkillsKit.Tests.csproj", "{D0125A95-FD63-4A33-9220-206D4A1A14F0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlexaSkillsKit.SampleCore", "AlexaSkillsKit.SampleCore\AlexaSkillsKit.SampleCore.csproj", "{877D93F7-DD52-406B-91C2-8DF9C5F9257D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlexaSkillsKit.SampleCore2", "AlexaSkillsKit.SampleCore2\AlexaSkillsKit.SampleCore2.csproj", "{9F529E87-083B-4457-9449-7D50E00DC077}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,8 +37,19 @@ Global {D0125A95-FD63-4A33-9220-206D4A1A14F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0125A95-FD63-4A33-9220-206D4A1A14F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0125A95-FD63-4A33-9220-206D4A1A14F0}.Release|Any CPU.Build.0 = Release|Any CPU + {877D93F7-DD52-406B-91C2-8DF9C5F9257D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {877D93F7-DD52-406B-91C2-8DF9C5F9257D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {877D93F7-DD52-406B-91C2-8DF9C5F9257D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {877D93F7-DD52-406B-91C2-8DF9C5F9257D}.Release|Any CPU.Build.0 = Release|Any CPU + {9F529E87-083B-4457-9449-7D50E00DC077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F529E87-083B-4457-9449-7D50E00DC077}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F529E87-083B-4457-9449-7D50E00DC077}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F529E87-083B-4457-9449-7D50E00DC077}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C4E53B59-D9EB-4215-9B38-FAB98A2AA9A4} + EndGlobalSection EndGlobal diff --git a/createPackages.cmd b/createPackages.cmd new file mode 100644 index 0000000..ef72671 --- /dev/null +++ b/createPackages.cmd @@ -0,0 +1,2 @@ + +powershell.exe -ExecutionPolicy ByPass -file createPackages.ps1 diff --git a/createPackages.ps1 b/createPackages.ps1 new file mode 100644 index 0000000..f2df946 --- /dev/null +++ b/createPackages.ps1 @@ -0,0 +1,8 @@ +# Author: Klaus Comelli +# Manually build multi-target packages using dotnet pack + +# Building DEBUG packages (incl. build action) +dotnet pack .\AlexaSkillsKit.Lib -c Debug -o .\bin\Packages\Debug --version-suffix "debug" + +# Building Release packages (incl. build action) +dotnet pack .\AlexaSkillsKit.Lib -c Release -o .\bin\Packages\Release \ No newline at end of file From 9646f87e88b9c33ba2cac1ab600e737ddb9a60ee Mon Sep 17 00:00:00 2001 From: Klaus Comelli Date: Fri, 26 Jan 2018 11:59:37 +0100 Subject: [PATCH 2/3] Updates version --- AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj b/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj index 7038c74..0faeed6 100755 --- a/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj +++ b/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj @@ -2,7 +2,7 @@ netstandard2.0;netstandard1.1;net45 1.7.0 - Stefan Negritoiu (FreeBusy) + Stefan Negritoiu (FreeBusy) and contributors Stefan Negritoiu (FreeBusy) AlexaSkillsKit AlexaSkillsKit.Net @@ -18,11 +18,12 @@ https://developer.amazon.com/public/binaries/content/gallery/developerportalpublic/solutions/alexa/dp_image_kit_02.png amazon echo alexa speechlet -1.3.0: Incorporated Sept 2015 ASK update for account linking and access tokens -1.4.0: Ability to override request validation policy and support for SSML output speech type -1.5.0: Fully implement certificate verification requirement and support for Standard cards -1.5.1: bug fix in certificate verification -1.7.0: migration to netstandard1.1 (supports .net 4.5+, .net core 1.x and .net core 2.x) + 1.3.0: Incorporated Sept 2015 ASK update for account linking and access tokens + 1.4.0: Ability to override request validation policy and support for SSML output speech type + 1.5.0: Fully implement certificate verification requirement and support for Standard cards + 1.5.1: bug fix in certificate verification + 1.6.0: migration to netstandard1.1 (supports .net 4.5+ and .net core 1.0+) + 1.7.0: migration to netstandard2.0 (supports .net 4.5+, .net core 1.0+ and .net core 2.0+) From 65ef4fff6398a17120e540737d5038a22c3d5f94 Mon Sep 17 00:00:00 2001 From: Klaus Comelli Date: Fri, 26 Jan 2018 12:13:02 +0100 Subject: [PATCH 3/3] Removed explicit package version requirements --- AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj b/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj index 0faeed6..a7f39c2 100755 --- a/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj +++ b/AlexaSkillsKit.Lib/AlexaSkillsKit.Lib.csproj @@ -28,12 +28,10 @@ $(DefineConstants);NETCORE;NETSTD11 - 1.6.1 $(AssetTargetFallback);dnxcore50 $(DefineConstants);NETCORE;NETSTD20 - 2.0.0 $(AssetTargetFallback);dnxcore50