From 13d722406853cf41b0b79b1cef957235b462da12 Mon Sep 17 00:00:00 2001 From: Stuart lang Date: Fri, 25 Feb 2022 16:50:11 +0000 Subject: [PATCH 1/3] Update dotnet lambdas to net6.0 --- legacy/aws-csharp/aws-csharp.csproj | 6 +++--- legacy/aws-csharp/build.cmd | 4 ++-- legacy/aws-csharp/build.sh | 4 ++-- legacy/aws-csharp/serverless.yml | 4 ++-- legacy/aws-fsharp/aws-fsharp.fsproj | 6 +++--- legacy/aws-fsharp/build.cmd | 4 ++-- legacy/aws-fsharp/build.sh | 4 ++-- legacy/aws-fsharp/serverless.yml | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/legacy/aws-csharp/aws-csharp.csproj b/legacy/aws-csharp/aws-csharp.csproj index c5b12e6c0..21bf601c5 100644 --- a/legacy/aws-csharp/aws-csharp.csproj +++ b/legacy/aws-csharp/aws-csharp.csproj @@ -1,15 +1,15 @@  - netcoreapp3.1 + net6.0 true CsharpHandlers aws-csharp - - + + diff --git a/legacy/aws-csharp/build.cmd b/legacy/aws-csharp/build.cmd index 61537bee6..7924be865 100644 --- a/legacy/aws-csharp/build.cmd +++ b/legacy/aws-csharp/build.cmd @@ -1,3 +1,3 @@ dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/hello.zip +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/hello.zip diff --git a/legacy/aws-csharp/build.sh b/legacy/aws-csharp/build.sh index daadffd82..506e16c08 100755 --- a/legacy/aws-csharp/build.sh +++ b/legacy/aws-csharp/build.sh @@ -8,5 +8,5 @@ then fi dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/hello.zip +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/hello.zip diff --git a/legacy/aws-csharp/serverless.yml b/legacy/aws-csharp/serverless.yml index 3eeec6bff..11565d72f 100644 --- a/legacy/aws-csharp/serverless.yml +++ b/legacy/aws-csharp/serverless.yml @@ -22,7 +22,7 @@ frameworkVersion: '3' provider: name: aws - runtime: dotnetcore3.1 + runtime: dotnet6 # you can overwrite defaults here # stage: dev @@ -59,7 +59,7 @@ functions: # you can add packaging information here package: - artifact: bin/Release/netcoreapp3.1/hello.zip + artifact: bin/Release/net6.0/hello.zip # exclude: # - exclude-me.js # - exclude-me-dir/** diff --git a/legacy/aws-fsharp/aws-fsharp.fsproj b/legacy/aws-fsharp/aws-fsharp.fsproj index 51c46416a..869027436 100644 --- a/legacy/aws-fsharp/aws-fsharp.fsproj +++ b/legacy/aws-fsharp/aws-fsharp.fsproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 FsharpHandlers aws-fsharp @@ -11,8 +11,8 @@ - - + + diff --git a/legacy/aws-fsharp/build.cmd b/legacy/aws-fsharp/build.cmd index 7b1550086..aabcd923e 100644 --- a/legacy/aws-fsharp/build.cmd +++ b/legacy/aws-fsharp/build.cmd @@ -1,4 +1,4 @@ dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/deploy-package.zip \ No newline at end of file +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/deploy-package.zip diff --git a/legacy/aws-fsharp/build.sh b/legacy/aws-fsharp/build.sh index cfd8e9bf9..a31cb7c15 100644 --- a/legacy/aws-fsharp/build.sh +++ b/legacy/aws-fsharp/build.sh @@ -8,5 +8,5 @@ then fi dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/deploy-package.zip \ No newline at end of file +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/deploy-package.zip diff --git a/legacy/aws-fsharp/serverless.yml b/legacy/aws-fsharp/serverless.yml index 2e946dc40..6513221b8 100644 --- a/legacy/aws-fsharp/serverless.yml +++ b/legacy/aws-fsharp/serverless.yml @@ -22,7 +22,7 @@ frameworkVersion: '3' provider: name: aws - runtime: dotnetcore3.1 + runtime: dotnet6 # you can overwrite defaults here # stage: dev @@ -52,7 +52,7 @@ provider: # you can add packaging information here package: - artifact: bin/Release/netcoreapp3.1/deploy-package.zip + artifact: bin/Release/net6.0/deploy-package.zip # exclude: # - exclude-me.js # - exclude-me-dir/** From a5a2cd79d6066fda7429c891dfaf40bd9496bdeb Mon Sep 17 00:00:00 2001 From: Stuart lang Date: Sun, 27 Feb 2022 13:19:23 +0000 Subject: [PATCH 2/3] Modernise C# --- legacy/aws-csharp/Handler.cs | 44 ++++++++++++++--------------- legacy/aws-csharp/aws-csharp.csproj | 5 ++++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/legacy/aws-csharp/Handler.cs b/legacy/aws-csharp/Handler.cs index 4c526b5d0..ed667eade 100644 --- a/legacy/aws-csharp/Handler.cs +++ b/legacy/aws-csharp/Handler.cs @@ -1,31 +1,29 @@ -using Amazon.Lambda.Core; - [assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] -namespace AwsDotnetCsharp + +namespace AwsDotnetCsharp; +public class Handler { - public class Handler + public Response Hello(Request request) { - public Response Hello(Request request) - { - return new Response("Go Serverless v1.0! Your function executed successfully!", request); - } + return new Response("Go Serverless v1.0! Your function executed successfully!", request); } +} - public class Response - { - public string Message {get; set;} - public Request Request {get; set;} +public class Response +{ + public string Message {get; set;} + public Request Request {get; set;} - public Response(string message, Request request){ - Message = message; - Request = request; - } - } + public Response(string message, Request request) + { + Message = message; + Request = request; + } +} - public class Request - { - public string Key1 {get; set;} - public string Key2 {get; set;} - public string Key3 {get; set;} - } +public class Request +{ + public string Key1 {get; set;} + public string Key2 {get; set;} + public string Key3 {get; set;} } diff --git a/legacy/aws-csharp/aws-csharp.csproj b/legacy/aws-csharp/aws-csharp.csproj index 21bf601c5..52714f627 100644 --- a/legacy/aws-csharp/aws-csharp.csproj +++ b/legacy/aws-csharp/aws-csharp.csproj @@ -5,6 +5,7 @@ true CsharpHandlers aws-csharp + enable @@ -12,4 +13,8 @@ + + + + From ba0827b8d062421ce547673eb37f9a218b3fe39a Mon Sep 17 00:00:00 2001 From: Stuart lang Date: Sun, 27 Feb 2022 13:29:07 +0000 Subject: [PATCH 3/3] Add ReadyToRun --- legacy/aws-csharp/aws-csharp.csproj | 3 ++- legacy/aws-fsharp/aws-fsharp.fsproj | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/legacy/aws-csharp/aws-csharp.csproj b/legacy/aws-csharp/aws-csharp.csproj index 52714f627..eb6b0c7e4 100644 --- a/legacy/aws-csharp/aws-csharp.csproj +++ b/legacy/aws-csharp/aws-csharp.csproj @@ -2,9 +2,10 @@ net6.0 - true CsharpHandlers aws-csharp + true + true enable diff --git a/legacy/aws-fsharp/aws-fsharp.fsproj b/legacy/aws-fsharp/aws-fsharp.fsproj index 869027436..a33348ef8 100644 --- a/legacy/aws-fsharp/aws-fsharp.fsproj +++ b/legacy/aws-fsharp/aws-fsharp.fsproj @@ -4,6 +4,7 @@ net6.0 FsharpHandlers aws-fsharp + true